Re: [Wikitech-l] Storing data across requests

2010-08-17 Thread Michael Dale
On 07/29/2010 10:15 AM, Bryan Tong Minh wrote:
 Hi,


 I have been working on getting asynchronous upload from url to work
 properly[1]. A problem that I encountered was that I need to store
 data across requests. Normally I would use $_SESSION, but this data
 should also be available to job runners, and $_SESSION isn't.


Could the job not include the session_id and upload_session_key .. then 
in your job handling code you just connect into that session via 
session_id( $session_id ); session_start(); to update the values ? .  
That seems like it would be more lightweight than DB status updates. .. 
I see Platonides suggested this as well.. ( that is how it was done 
originally done but with a background php process rather than jobs table 
) see 
http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/HttpFunctions.php?view=markuppathrev=53825
  
line 145 ( doSessionIdDownload )

--michael

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


Re: [Wikitech-l] Storing data across requests

2010-07-30 Thread Bryan Tong Minh
On Fri, Jul 30, 2010 at 5:32 PM, Aryeh Gregor
simetrical+wikil...@gmail.com wrote:
 On Thu, Jul 29, 2010 at 6:07 PM, Platonides platoni...@gmail.com wrote:
 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 ) ;

 This means that if a memcached server goes down, the information will
 be lost.  The database is the correct place to put this.  (Also the
 correct place to put sessions, for that matter . . .)

Also, on places where no memcached or equivalent is available (i.e.
CACHE_NONE), this will not work.
I think the loss of session data due to memcached breakage was found
to be acceptable. Does anybody have some references for this?


Bryan

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


Re: [Wikitech-l] Storing data across requests

2010-07-30 Thread Platonides
Chad wrote:
 On Fri, Jul 30, 2010 at 3:57 PM, Platonides platoni...@gmail.com wrote:
 Bryan Tong Minh wrote:
 Also, on places where no memcached or equivalent is available (i.e.
 CACHE_NONE), this will not work.

 Then you could be using the objectcache table in the database.
 
 No, that's CACHE_DB. CACHE_NONE really means what it
 says.
 
 -Chad

There's no CACHE_NONE environment by itself. Just sysadmins disabling
the caching. So if $wgMainCacheType is CACHE_NONE, block the feature or
treat it as CACHE_ANYTHING for features that require it.

You know, everybody should have a writable db for running mediawiki...


___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


Re: [Wikitech-l] Storing data across requests

2010-07-29 Thread Aryeh Gregor
On Thu, Jul 29, 2010 at 1:15 PM, Bryan Tong Minh
bryan.tongm...@gmail.com wrote:
 I have been working on getting asynchronous upload from url to work
 properly[1]. A problem that I encountered was that I need to store
 data across requests. Normally I would use $_SESSION, but this data
 should also be available to job runners, and $_SESSION isn't.

Isn't this what the job table is for?

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l