limit history sync to the last 500 items; load snapshots from the right directory in the profile
authorDan Mills <thunder@mozilla.com>
Fri, 21 Dec 2007 16:07:42 -0800
changeset 44327 1329151a0ef1a9fd4ddf9967e15304089bd44f6f
parent 44326 2b6ed000bbba7c0c36d0fc1335208c856a1f1b32
child 44328 4a315d664e19dc6ebbe992bac28b096373232d08
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
limit history sync to the last 500 items; load snapshots from the right directory in the profile
services/sync/modules/engines.js
services/sync/modules/stores.js
--- a/services/sync/modules/engines.js
+++ b/services/sync/modules/engines.js
@@ -498,16 +498,18 @@ Engine.prototype = {
         if (status.formatVersion == 0) {
           ret.snapEncryption = status.snapEncryption = "none";
           ret.deltasEncryption = status.deltasEncryption = "none";
         }
   
         if (status.GUID != this._snapshot.GUID) {
           this._log.info("Remote/local sync GUIDs do not match.  " +
                       "Forcing initial sync.");
+          this._log.debug("Remote: " + status.GUID);
+          this._log.debug("Local: " + this._snapshot.GUID);
           this._store.resetGUIDs();
           this._snapshot.data = {};
           this._snapshot.version = -1;
           this._snapshot.GUID = status.GUID;
         }
   
         if (this._snapshot.version < status.snapVersion) {
           if (this._snapshot.version >= 0)
--- a/services/sync/modules/stores.js
+++ b/services/sync/modules/stores.js
@@ -199,17 +199,18 @@ SnapshotStore.prototype = {
                snapshot: this.data};
     out = uneval(out);
     fos.write(out, out.length);
     fos.close();
   },
 
   load: function SStore_load() {
     let file = this._dirSvc.get("ProfD", Ci.nsIFile);
-    file.append("weave-snapshots");
+    file.append("weave");
+    file.append("snapshots");
     file.append(this.filename);
 
     if (!file.exists())
       return;
 
     let fis = Cc["@mozilla.org/network/file-input-stream;1"].
       createInstance(Ci.nsIFileInputStream);
     fis.init(file, MODE_RDONLY, PERMS_FILE, 0);
@@ -600,30 +601,32 @@ HistoryStore.prototype = {
       this._hsvc.setPageDetails(makeURI(command.GUID), command.data.title,
 				command.data.accessCount, false, false);
     } catch (e) {
       this._log.error("Exception caught: " + (e.message? e.message : e));
     }
   },
 
   _removeCommand: function HistStore__removeCommand(command) {
-    this._log.info("  -> removing history entry: " + command.GUID);
-    this._browserHist.removePage(command.GUID);
+    this._log.info("  -> NOT removing history entry: " + command.GUID);
+    //this._browserHist.removePage(command.GUID);
   },
 
   _editCommand: function HistStore__editCommand(command) {
     this._log.info("  -> FIXME: NOT editing history entry: " + command.GUID);
     // FIXME: implement!
   },
 
   _historyRoot: function HistStore__historyRoot() {
     let query = this._hsvc.getNewQuery(),
         options = this._hsvc.getNewQueryOptions();
 
     query.minVisits = 1;
+    options.maxResults = 500;
+    options.sortingMode = query.SORT_BY_LASTMODIFIED_DESCENDING;
     options.queryType = options.QUERY_TYPE_HISTORY;
 
     let root = this._hsvc.executeQuery(query, options).root;
     root.QueryInterface(Ci.nsINavHistoryQueryResultNode);
     return root;
   },
 
   wrap: function HistStore_wrap() {