Browse Source

temp

master
Eduard Kuzmenko 4 years ago
parent
commit
0541485f5e
  1. 2
      src/components/lazyLoadQueue.ts
  2. 12
      src/lib/appManagers/apiUpdatesManager.ts
  3. 1
      src/lib/appManagers/appImManager.ts
  4. 9
      src/lib/appManagers/appMessagesManager.ts
  5. 2
      src/lib/mtproto/apiFileManager.ts
  6. 2
      src/lib/mtproto/transports/tcpObfuscated.ts

2
src/components/lazyLoadQueue.ts

@ -13,7 +13,7 @@ type LazyLoadElement = Omit<LazyLoadElementBase, 'load'> & { @@ -13,7 +13,7 @@ type LazyLoadElement = Omit<LazyLoadElementBase, 'load'> & {
wasSeen?: boolean,
};
const PARALLEL_LIMIT = Infinity;
const PARALLEL_LIMIT = 8;
export class LazyLoadQueueBase {
public queueId = 0;

12
src/lib/appManagers/apiUpdatesManager.ts

@ -25,7 +25,7 @@ type UpdatesState = { @@ -25,7 +25,7 @@ type UpdatesState = {
lastPtsUpdateTime?: number
};
const SYNC_DELAY = 25;
const SYNC_DELAY = 6;
export class ApiUpdatesManager {
public updatesState: UpdatesState = {
@ -38,7 +38,7 @@ export class ApiUpdatesManager { @@ -38,7 +38,7 @@ export class ApiUpdatesManager {
public channelStates: {[channelId: number]: UpdatesState} = {};
private attached = false;
private log = logger('UPDATES', LogLevels.error/* | LogLevels.log */);
private log = logger('UPDATES', LogLevels.error | LogLevels.log | LogLevels.warn | LogLevels.debug);
constructor() {
// * false for test purposes
@ -137,7 +137,7 @@ export class ApiUpdatesManager { @@ -137,7 +137,7 @@ export class ApiUpdatesManager {
}
}
processUpdateMessage = (updateMessage: any, options: Partial<{
public processUpdateMessage = (updateMessage: any, options: Partial<{
ignoreSyncLoading: boolean
}> = {}) => {
// return forceGetDifference()
@ -148,6 +148,8 @@ export class ApiUpdatesManager { @@ -148,6 +148,8 @@ export class ApiUpdatesManager {
ignoreSyncLoading: options.ignoreSyncLoading
};
this.log('processUpdateMessage', updateMessage);
switch(updateMessage._) {
case 'updatesTooLong':
case 'new_session_created':
@ -425,7 +427,7 @@ export class ApiUpdatesManager { @@ -425,7 +427,7 @@ export class ApiUpdatesManager {
if(update._ === 'updateChannelTooLong') {
if(!curState.lastPtsUpdateTime ||
curState.lastPtsUpdateTime < Date.now() - 10000) {
curState.lastPtsUpdateTime < (Date.now() - SYNC_DELAY)) {
// this.log.trace('channel too long, get diff', channelId, update)
this.getChannelDifference(channelId);
}
@ -579,7 +581,7 @@ export class ApiUpdatesManager { @@ -579,7 +581,7 @@ export class ApiUpdatesManager {
} else {
// ! for testing
/* state.seq = 1;
state.pts = state.pts - 1000;
state.pts = state.pts - 15;
state.date = 1; */
Object.assign(this.updatesState, state);

1
src/lib/appManagers/appImManager.ts

@ -36,7 +36,6 @@ import appDownloadManager from './appDownloadManager'; @@ -36,7 +36,6 @@ import appDownloadManager from './appDownloadManager';
import appStateManager, { AppStateManager } from './appStateManager';
import { MOUNT_CLASS_TO } from '../../config/debug';
import appNavigationController from '../../components/appNavigationController';
import { isSafari } from '../../helpers/userAgent';
//console.log('appImManager included33!');

9
src/lib/appManagers/appMessagesManager.ts

@ -259,6 +259,11 @@ export class AppMessagesManager { @@ -259,6 +259,11 @@ export class AppMessagesManager {
if(removeUnread && dialog.unread_count) dialog.unread_count -= removeUnread;
if(dialog.peerId < 0 && dialog.pts) {
const newPts = apiUpdatesManager.channelStates[-dialog.peerId].pts;
dialog.pts = newPts;
}
dialog.unread_count = Math.max(0, dialog.unread_count);
dialogs.push(dialog);
@ -3652,6 +3657,10 @@ export class AppMessagesManager { @@ -3652,6 +3657,10 @@ export class AppMessagesManager {
this.saveMessages([message], {storage});
// this.log.warn(dT(), 'message unread', message.mid, message.pFlags.unread)
/* if((message as Message.message).grouped_id) {
this.log('updateNewMessage', message);
} */
const pendingMessage = this.checkPendingMessage(message);
const historyStorage = this.getHistoryStorage(peerId);
this.updateMessageRepliesIfNeeded(message);

2
src/lib/mtproto/apiFileManager.ts

@ -87,7 +87,7 @@ export class ApiFileManager { @@ -87,7 +87,7 @@ export class ApiFileManager {
public downloadCheck(dcId: string | number) {
const downloadPull = this.downloadPulls[dcId];
const downloadLimit = dcId === 'upload' ? 24 : 48;
const downloadLimit = dcId === 'upload' ? 24 : 24;
//const downloadLimit = Infinity;
if(this.downloadActives[dcId] >= downloadLimit || !downloadPull || !downloadPull.length) {

2
src/lib/mtproto/transports/tcpObfuscated.ts

@ -18,7 +18,7 @@ export default class TcpObfuscated implements MTTransport { @@ -18,7 +18,7 @@ export default class TcpObfuscated implements MTTransport {
bodySent: boolean
}>> = [];
private debug = Modes.debug && false;
private debug = Modes.debug && false/* true */;
private log: ReturnType<typeof logger>;
public connected = false;
private lastCloseTime: number;

Loading…
Cancel
Save