Вопрос

Bad question wording, I apologize.

Basically, in my app, the admin can set the background of the entire page. We do this by storing a variable called MyApp::COLOR. When the admin sets a background color through the admin panel, we store that color in MyApp::COLOR.

Sometimes we see the new color, sometimes we see the old color.

The thing is, our app has a few dynos on Heroku. Am I correct in assuming that these constants are stored in memory, and local to the dyno where they are stored?

I.e. global variables set (at application scope) in the middle of application execution are not available across dynos?

Это было полезно?

Решение

You can think of Heroku dynos as completely independent servers running a copy of all your code, with their own local, temporary file system. In reality they're virtual servers running on EC2, but the result is the same.

This means the memory of one server is definitely not accessible from another. You need to use a shared data store, like a database, that all your dynos connect to.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top