You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-08-09 10:22:46 +03:00
Remove spurious changes
This commit is contained in:
@@ -2777,7 +2777,7 @@ MatrixClient.prototype.startClient = function(opts) {
|
||||
}
|
||||
|
||||
// periodically poll for turn servers if we support voip
|
||||
//checkTurnServers(this);
|
||||
checkTurnServers(this);
|
||||
|
||||
if (this._syncApi) {
|
||||
// This shouldn't happen since we thought the client was not running
|
||||
|
@@ -231,7 +231,7 @@ export default class DeviceList {
|
||||
// refresh request).
|
||||
// By checking it is at least a string, we can eliminate a class of
|
||||
// silly errors.
|
||||
if (typeof userId !== 'string' && typeof userId !== 'object') {
|
||||
if (typeof userId !== 'string') {
|
||||
throw new Error('userId must be a string; was '+userId);
|
||||
}
|
||||
this._pendingUsersWithNewDevices[userId] = true;
|
||||
|
@@ -33,7 +33,7 @@ const VERSION = 1;
|
||||
// so infrequently that the /sync size gets bigger on reload. Writing more
|
||||
// often does not affect the length of the pause since the entire /sync
|
||||
// response is persisted each time.
|
||||
const WRITE_DELAY_MS = 1000 * 60 * 100; // once every 5 minutes
|
||||
const WRITE_DELAY_MS = 1000 * 60 * 5; // once every 5 minutes
|
||||
|
||||
/**
|
||||
* Construct a new Indexed Database store backend. This requires a call to
|
||||
|
49
src/sync.js
49
src/sync.js
@@ -82,9 +82,6 @@ function SyncApi(client, opts) {
|
||||
this._keepAliveTimer = null;
|
||||
this._connectionReturnedDefer = null;
|
||||
this._notifEvents = []; // accumulator of sync events in the current sync response
|
||||
client._fns = {
|
||||
// eventName: function
|
||||
};
|
||||
|
||||
if (client.getNotifTimelineSet()) {
|
||||
reEmit(client, client.getNotifTimelineSet(),
|
||||
@@ -428,8 +425,7 @@ SyncApi.prototype.sync = function() {
|
||||
// no push rules for guests, no access to POST filter for guests.
|
||||
self._sync({});
|
||||
} else {
|
||||
//getPushRules();
|
||||
self._sync({});
|
||||
getPushRules();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -474,7 +470,6 @@ SyncApi.prototype.retryImmediately = function() {
|
||||
SyncApi.prototype._sync = function(syncOptions) {
|
||||
const client = this.client;
|
||||
const self = this;
|
||||
console.log("_sync");
|
||||
|
||||
if (!this._running) {
|
||||
debuglog("Sync no longer running: exiting.");
|
||||
@@ -537,13 +532,10 @@ SyncApi.prototype._sync = function(syncOptions) {
|
||||
}
|
||||
|
||||
let isCachedResponse = false;
|
||||
console.log("syncOptions => ", syncOptions, self.opts);
|
||||
if (self.opts.syncAccumulator && !syncOptions.hasSyncedBefore) {
|
||||
|
||||
let data = self.opts.syncAccumulator.getJSON();
|
||||
// Don't do an HTTP hit to /sync. Instead, load up the persisted /sync data,
|
||||
// if there is data there.
|
||||
console.log("Data: ", data);
|
||||
if (data.nextBatch) {
|
||||
debuglog("sync(): not doing HTTP hit, instead returning stored /sync data");
|
||||
// We must deep copy the stored data so that the /sync processing code doesn't
|
||||
@@ -561,15 +553,10 @@ SyncApi.prototype._sync = function(syncOptions) {
|
||||
}
|
||||
|
||||
if (!isCachedResponse) {
|
||||
/*
|
||||
debuglog('Starting sync since=' + syncToken);
|
||||
// debuglog('Starting sync since=' + syncToken);
|
||||
this._currentSyncRequest = client._http.authedRequest(
|
||||
undefined, "GET", "/sync", qps, undefined, clientSideTimeoutMs,
|
||||
); */
|
||||
|
||||
|
||||
var d = q.defer();
|
||||
this._currentSyncRequest = d.promise;
|
||||
);
|
||||
}
|
||||
|
||||
this._currentSyncRequest.done(function(data) {
|
||||
@@ -1227,23 +1214,21 @@ function createNewUser(client, userId) {
|
||||
return user;
|
||||
}
|
||||
|
||||
function reEmit(client, emittableEntity, eventNames) {
|
||||
eventNames.forEach((name) => {
|
||||
if (!client._fns[name]) {
|
||||
client._fns[name] = function() {
|
||||
// take the args from the listener and reuse them, adding the
|
||||
// event name to the arg list so it works with .emit()
|
||||
// Transformation Example:
|
||||
// listener on "foo" => function(a,b) { ... }
|
||||
// Re-emit on "thing" => thing.emit("foo", a, b)
|
||||
const newArgs = [name];
|
||||
for (let i = 0; i < arguments.length; i++) {
|
||||
newArgs.push(arguments[i]);
|
||||
}
|
||||
client.emit(...newArgs);
|
||||
function reEmit(reEmitEntity, emittableEntity, eventNames) {
|
||||
utils.forEach(eventName, function(eventName) {
|
||||
// setup a listener on the entity (the Room, User, etc) for this event
|
||||
emittableEntity.on(eventName, function() {
|
||||
// take the args from the listener and reuse them, adding the
|
||||
// event name to the arg list so it works with .emit()
|
||||
// Transformation Example:
|
||||
// listener on "foo" => function(a,b) { ... }
|
||||
// Re-emit on "thing" => thing.emit("foo", a, b)
|
||||
const newArgs = [eventName];
|
||||
for (let i = 0; i < arguments.length; i++) {
|
||||
newArgs.push(arguments[i]);
|
||||
}
|
||||
}
|
||||
emittableEntity.on(name, client._fns[name]);
|
||||
reEmitEntity.emit(...newArgs);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user