From 3fdf4fc63c5461d9d87370497bbe21e40643defd Mon Sep 17 00:00:00 2001 From: Devin Binnie <52460000+devinbinnie@users.noreply.github.com> Date: Mon, 13 May 2024 08:55:21 -0400 Subject: [PATCH] Use GetMasterX() to ensure writeability for the RefreshPostStats job (#26986) --- server/channels/store/sqlstore/user_store.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/channels/store/sqlstore/user_store.go b/server/channels/store/sqlstore/user_store.go index db8d4d7c03e11..db36c220e4bb1 100644 --- a/server/channels/store/sqlstore/user_store.go +++ b/server/channels/store/sqlstore/user_store.go @@ -2260,7 +2260,7 @@ func (us SqlUserStore) GetUsersWithInvalidEmails(page int, perPage int, restrict func (us SqlUserStore) RefreshPostStatsForUsers() error { if us.DriverName() == model.DatabaseDriverPostgres { - if _, err := us.GetReplicaX().Exec("REFRESH MATERIALIZED VIEW poststats"); err != nil { + if _, err := us.GetMasterX().Exec("REFRESH MATERIALIZED VIEW poststats"); err != nil { return errors.Wrap(err, "users_refresh_post_stats_exec") } } else {