Site setting is different Every time on Ubuntu development installation

Hello I am building a forum site.

I tried to change the site settings and refresh the site,
I cannot get the changed values ​​intermittently.

Each refresh seems to show the previously cached values.

I Adjusted the number of puma workers, but it does do same.

The changed value is put in the database.

Is it a problem of message_bus?
If so, how should I change the settings configure?

Please reply to me. Thank you!

1 Like

How exactly did you install Discourse?

1 Like

I’m seeing the same thing. If I set the Puma worker count to 1 the issue goes away. It appears that each worker is holding a copy of the site settings object, and when one worker performs an update the other workers are never aware of that update.

Unfortunately, this issue is also present in a scaled-out environment with multiple Discourse servers, so just setting the worker count to 1 isn’t a total fix.

I need to ask the same thing: How exactly did you install Discourse?

When installed following the only supported method, we don’t use Puma, and this bug is not present.

1 Like

I’m trying to do some plugin development, so I followed the link in the README to setup an Ubuntu development environment. When I run the command bundle exec rails server --binding=0.0.0.0 it starts the app with Puma.

The only thing like that I’ve seen is if the server is stopped the browser will sometimes return a json file or the cached version of the site.

Is the server still running?

Another thing I do is open another terminal and run

./bin/rails c

And change settings there with something like

SiteSetting.title=“my title”

The server is still running. I’ve verified from the logs that Discourse is serving the request. I also have cache disabled in my browser’s developer console while I’m debugging this.

Why are you scaling out during plugin development?

The symptoms indicate that your internal MessageBus is broken, so something’s wrong with your Redis setup. Live updates in the browser may also be broken.

2 Likes

I wasn’t scaling out for plugin development, just testing this in a few different scenarios to try to narrow down my issue and make sure I understood it. If the MessageBus is supposed to handle this then I will look into that further.

While debugging, I did notice that app/models/site_setting.rb is still triggering a :site_setting_saved event, which appears to have been removed from the app and replaced with :site_setting_changed. There is nothing listening to the :site_setting_saved event anymore.

You can run the Unicorn web server in development with bin/unicorn too.

1 Like