python - Django - Two Users Accessing The Same Data -


let's have django web application 2 users. web application has global variable exist on server (a pandas dataframe created data external sql database).

let's user makes update request dataframe , dataframe being updated. dataframe being updated, other user makes get request dataframe. there way 'lock' dataframe until user 1 finished , finish request made user 2?

edit:

so order of events should be:

user 1 makes update request, dataframe locked, user 2 makes request, dataframe finished updating, dataframe unlocked, user 2 gets his/her request.

lines of code appreciated!

ehm... django not server. has single-threaded development server in it, should not used beyond development , maybe not that. django applications deployed using wsgi. wsgi server running app start several separate worker threads , killing , restarting these threads according rules in configuration.

this means, cannot rely on multiple requests hitting same process. django app lifecycle between getting request , returning response. not explicitly made persistent between 2 events should considered gone.

so, when 1 of users updates global variable, variable exists in 1 process user randomly accessed. second user might or might not hit same process , therefore might or might not same copy of variable. more that, process sooner or later killed wsgi server , updates gone.

what getting @ might want rethink architecture before bother atomic update problems.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -