> However, the worker has to use the updated hash to select items that might
> have been updated from the data that was supposed to be updated from the
> reloaded data. However it is not. For me to get updated data that works I
> have to do a touch reload which defeats the purpose. Below is my logic.
> So how do I resolve?
>
I assume you are using global updated_hash. Global variables are not
compatible with most web server process models. The global variable might
end up in a different process, dead process, etc.
I suggest you just keep *all* your data in a Redis and if you need to
maintain a state variable, create a single Redis key for it.
As a golden rule never write to global variables in Python web service
processes (well... technically you can do it, but you really must know what
you are doing).
Thanks,
Mikko
>
> Thanks
>
>
> from uwsgidecorators import *
> @rbtimer(120,target='workers')
> def load_redis(signum):
> updated_hash = redis.get('data')
> with open('/tmp/meta_post.json', 'w') as outfile:
> json.dump(updated_hash, outfile, indent=4, sort_keys=True)
> <-THIS WORKS
>
>
> def foo(updated_hash){
> do stuff
>
> @get('/hash/')
> def hash():
>
> json_data = foo(updated_hash) <- THIS USES OLD DATA
> return json_data
>
> _______________________________________________
> uWSGI mailing list
> [email protected]
> http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
>
>
--
Mikko Ohtamaa
http://opensourcehacker.com
http://twitter.com/moo9000
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi