Cscott has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/52072


Change subject: WIP: Allow parsoid to run offline by replaying cached API 
requests.
......................................................................

WIP: Allow parsoid to run offline by replaying cached API requests.

Change-Id: I38a9671d54a9f27c74d544cddd2712da8c28996b
---
M js/lib/mediawiki.ApiRequest.js
1 file changed, 15 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Parsoid 
refs/changes/72/52072/1

diff --git a/js/lib/mediawiki.ApiRequest.js b/js/lib/mediawiki.ApiRequest.js
index 67b1a62..e2bdddb 100644
--- a/js/lib/mediawiki.ApiRequest.js
+++ b/js/lib/mediawiki.ApiRequest.js
@@ -45,6 +45,15 @@
 // Inherit from EventEmitter
 util.inherits(ApiRequest, events.EventEmitter);
 
+ApiRequest.prototype.request = function(options, callback) {
+       // lookaside to a cache if we're running offline
+       if (env.conf.parsoid.logRequests) {
+       }
+       if (env.conf.parsoid.offline) {
+       }
+       return request(options, callback);
+};
+
 ApiRequest.prototype.processListeners = function ( error, src ) {
        // Process only a few callbacks in each event loop iteration to
        // reduce memory usage.
@@ -78,7 +87,7 @@
                        this.env.tp( 'Retrying ' + this.reqType + ' request for 
' + this.title + ', ' +
                                        this.retries + ' remaining' );
                        // retry
-                       request( this.requestOptions, this.requestCB.bind(this) 
);
+                       this.request( this.requestOptions, 
this.requestCB.bind(this) );
                        return;
                } else {
                        var dnee = new DoesNotExistError( this.reqType + ' 
failure for ' + this.title );
@@ -150,7 +159,7 @@
        };
 
        // Start the request
-       request( this.requestOptions, this.requestCB.bind(this) );
+       this.request( this.requestOptions, this.requestCB.bind(this) );
 }
 
 // Inherit from ApiRequest
@@ -222,7 +231,7 @@
                                } );
                
//'?format=json&action=query&prop=revisions&rvprop=content&titles=' + title;
                this.requestOptions.url = url;
-               request( this.requestOptions, this.requestCB.bind(this) );
+               this.request( this.requestOptions, this.requestCB.bind(this) );
                return;
        }
 
@@ -274,7 +283,7 @@
        };
 
        // Start the request
-       request( this.requestOptions, this.requestCB.bind(this) );
+       this.request( this.requestOptions, this.requestCB.bind(this) );
 }
 
 
@@ -347,7 +356,7 @@
        };
 
        // Start the request
-       request( this.requestOptions, this.requestCB.bind(this) );
+       this.request( this.requestOptions, this.requestCB.bind(this) );
 }
 
 // Inherit from ApiRequest
@@ -424,7 +433,7 @@
                }
        };
 
-       request( this.requestOptions, this.requestCB.bind( this ) );
+       this.request( this.requestOptions, this.requestCB.bind( this ) );
 };
 
 util.inherits( ConfigRequest, ApiRequest );

-- 
To view, visit https://gerrit.wikimedia.org/r/52072
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I38a9671d54a9f27c74d544cddd2712da8c28996b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: Cscott <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to