rename send scheduler to request scheduler

This commit is contained in:
Bruno Windels 2020-09-22 13:49:01 +02:00
parent 0a00d4c865
commit 5660e0f4f0
2 changed files with 11 additions and 11 deletions

View File

@ -16,7 +16,7 @@ limitations under the License.
import {Room} from "./room/Room.js"; import {Room} from "./room/Room.js";
import { ObservableMap } from "../observable/index.js"; import { ObservableMap } from "../observable/index.js";
import {SendScheduler} from "./SendScheduler.js"; import {RequestScheduler} from "./net/RequestScheduler.js";
import {User} from "./User.js"; import {User} from "./User.js";
import {DeviceMessageHandler} from "./DeviceMessageHandler.js"; import {DeviceMessageHandler} from "./DeviceMessageHandler.js";
import {Account as E2EEAccount} from "./e2ee/Account.js"; import {Account as E2EEAccount} from "./e2ee/Account.js";
@ -45,8 +45,8 @@ export class Session {
constructor({clock, storage, unwrappedHsApi, sessionInfo, olm, olmWorker, cryptoDriver, mediaRepository}) { constructor({clock, storage, unwrappedHsApi, sessionInfo, olm, olmWorker, cryptoDriver, mediaRepository}) {
this._clock = clock; this._clock = clock;
this._storage = storage; this._storage = storage;
this._sendScheduler = new SendScheduler({hsApi: unwrappedHsApi, clock}); this._requestScheduler = new RequestScheduler({hsApi: unwrappedHsApi, clock});
this._hsApi = this._sendScheduler.createHomeServerApiWrapper(); this._hsApi = this._requestScheduler.createHomeServerApiWrapper();
this._mediaRepository = mediaRepository; this._mediaRepository = mediaRepository;
this._syncInfo = null; this._syncInfo = null;
this._sessionInfo = sessionInfo; this._sessionInfo = sessionInfo;
@ -268,12 +268,12 @@ export class Session {
} }
get isStarted() { get isStarted() {
return this._sendScheduler.isStarted; return this._requestScheduler.isStarted;
} }
dispose() { dispose() {
this._olmWorker?.dispose(); this._olmWorker?.dispose();
this._sendScheduler.stop(); this._requestScheduler.stop();
this._sessionBackup?.dispose(); this._sessionBackup?.dispose();
for (const room of this._rooms.values()) { for (const room of this._rooms.values()) {
room.dispose(); room.dispose();
@ -297,7 +297,7 @@ export class Session {
const operations = await opsTxn.operations.getAll(); const operations = await opsTxn.operations.getAll();
const operationsByScope = groupBy(operations, o => o.scope); const operationsByScope = groupBy(operations, o => o.scope);
this._sendScheduler.start(); this._requestScheduler.start();
for (const [, room] of this._rooms) { for (const [, room] of this._rooms) {
let roomOperationsByType; let roomOperationsByType;
const roomOperations = operationsByScope.get(room.id); const roomOperations = operationsByScope.get(room.id);

View File

@ -14,10 +14,10 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import {AbortError} from "../utils/error.js"; import {AbortError} from "../../utils/error.js";
import {HomeServerError} from "./error.js"; import {HomeServerError} from "../error.js";
import {HomeServerApi} from "./net/HomeServerApi.js"; import {HomeServerApi} from "./HomeServerApi.js";
import {ExponentialRetryDelay} from "./net/ExponentialRetryDelay.js"; import {ExponentialRetryDelay} from "./ExponentialRetryDelay.js";
class Request { class Request {
constructor(methodName, args) { constructor(methodName, args) {
@ -58,7 +58,7 @@ for (const methodName of Object.getOwnPropertyNames(HomeServerApi.prototype)) {
} }
} }
export class SendScheduler { export class RequestScheduler {
constructor({hsApi, clock}) { constructor({hsApi, clock}) {
this._hsApi = hsApi; this._hsApi = hsApi;
this._clock = clock; this._clock = clock;