Bryan Tong Minh wrote:
Or is there any other mechanism to be able to share data between the jobqueue and requests?
Regards, Bryan
Memcached*
Our $_SESSION simply lives in memcached. So we could do $fake_session = $wgMemc->get( wfMemcKey( 'session', $session_id ) ) ; $fake_session["upload_ok"] = true; $wgMemc->set( wfMemcKey( 'session', $session_id ), $fake_session, 3600 ) ;
One could also use (more portable): session_id( $session_id ); $_SESSION["upload_ok"] = true; session_commit(); but that may be riskier when job is run inside a web request, you would need to switch dynamically sessions (there's a sample of that in http://es.php.net/manual/es/ref.session.php#96309).
If a user web request finishes at the same time a job runs it, or two upload jobs finish at the same time, the result is probably undefined so you may prefer to store in the session pointers to memcached where the result is stored.
Another solution would be to create a general notification framework. File uploads could store its results there, producing a popup to the user, CentralAuth could store there "Your talk on XY has been changed" notifications, tagging a file as copyvio/for deletion could produce a notification on the uploader...
*In the MediaWiki sense of an ObjectCache which can be backed by memcached, a database, an accelerator...