Skip to content

Commit

Permalink
Fix issues with uploads
Browse files Browse the repository at this point in the history
  • Loading branch information
rojvv committed May 24, 2024
1 parent 7772089 commit e4eb8e4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
12 changes: 12 additions & 0 deletions client/2_update_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ export class UpdateManager {
}

async fetchState(source: string) {
if (this.#c.cdn) {
return;
}
let state = await this.#c.invoke({ _: "updates.getState" });
const difference = await this.#c.invoke({ ...state, _: "updates.getDifference" });
if (is("updates.difference", difference)) {
Expand Down Expand Up @@ -436,6 +439,9 @@ export class UpdateManager {

#processUpdatesQueue = new Queue("UpdateManager/processUpdates");
processUpdates(updates: Api.Update | Api.Updates, checkGap: boolean, call: Api.AnyObject | null = null, callback?: () => void) {
if (this.#c.cdn) {
return;
}
this.#processUpdatesQueue.add(() => this.#processUpdates(updates, checkGap, call).then(callback));
}

Expand Down Expand Up @@ -629,6 +635,9 @@ export class UpdateManager {
return localState;
}
async recoverUpdateGap(source: string) {
if (this.#c.cdn) {
return;
}
this.#LrecoverUpdateGap.debug(`recovering from update gap [${source}]`);

this.#c.setConnectionState("updating");
Expand Down Expand Up @@ -793,6 +802,9 @@ export class UpdateManager {
}

setUpdateHandler(handler: UpdateHandler) {
if (this.#c.cdn) {
return;
}
this.#updateHandler = handler;
}
}
2 changes: 1 addition & 1 deletion client/5_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ export class Client<C extends Context = Context> extends Composer<C> {
});

return {
invoke: client.invoke,
invoke: client.invoke.bind(client),
connect: async () => {
await client.connect();

Expand Down
10 changes: 4 additions & 6 deletions connection/1_connection_tcp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,10 @@ export class ConnectionTCP implements Connection {
this.#canRead = false;
break;
} catch (err) {
if (!this.connected) {
this.stateChangeHandler?.(false);
this.#rejectRead();
} else {
L.error(err);
}
this.#canRead = false;
this.stateChangeHandler?.(false);
this.#rejectRead();
L.error(err);
}
} while (this.connected);
this.stateChangeHandler?.(false);
Expand Down

0 comments on commit e4eb8e4

Please sign in to comment.