Fix FILE_REFERENCE_EXPIRED
Fix api timeout error
This commit is contained in:
parent
baaef96f03
commit
93be4cf3ac
@ -60,27 +60,29 @@ export class AppDocsManager {
|
||||
}
|
||||
|
||||
//console.log('saveDoc', apiDoc, this.docs[apiDoc.id]);
|
||||
if(oldDoc) {
|
||||
//if(doc._ !== 'documentEmpty' && doc._ === d._) {
|
||||
if(doc.thumbs) {
|
||||
if(!oldDoc.thumbs) oldDoc.thumbs = doc.thumbs;
|
||||
/* else if(apiDoc.thumbs[0].bytes && !d.thumbs[0].bytes) {
|
||||
d.thumbs.unshift(apiDoc.thumbs[0]);
|
||||
} else if(d.thumbs[0].url) { // fix for converted thumb in safari
|
||||
apiDoc.thumbs[0] = d.thumbs[0];
|
||||
} */
|
||||
}
|
||||
// if(oldDoc) {
|
||||
// //if(doc._ !== 'documentEmpty' && doc._ === d._) {
|
||||
// if(doc.thumbs) {
|
||||
// if(!oldDoc.thumbs) oldDoc.thumbs = doc.thumbs;
|
||||
// /* else if(apiDoc.thumbs[0].bytes && !d.thumbs[0].bytes) {
|
||||
// d.thumbs.unshift(apiDoc.thumbs[0]);
|
||||
// } else if(d.thumbs[0].url) { // fix for converted thumb in safari
|
||||
// apiDoc.thumbs[0] = d.thumbs[0];
|
||||
// } */
|
||||
// }
|
||||
|
||||
//}
|
||||
// //}
|
||||
|
||||
return oldDoc;
|
||||
// return oldDoc;
|
||||
|
||||
//return Object.assign(d, apiDoc, context);
|
||||
//return context ? Object.assign(d, context) : d;
|
||||
// //return Object.assign(d, apiDoc, context);
|
||||
// //return context ? Object.assign(d, context) : d;
|
||||
// }
|
||||
|
||||
if(!oldDoc) {
|
||||
this.docs[doc.id] = doc;
|
||||
}
|
||||
|
||||
this.docs[doc.id] = doc;
|
||||
|
||||
// * exclude from state
|
||||
// defineNotNumerableProperties(doc, [/* 'thumbs', */'type', 'h', 'w', 'file_name',
|
||||
// 'file', 'duration', 'downloaded', 'url', 'audioTitle',
|
||||
@ -212,6 +214,10 @@ export class AppDocsManager {
|
||||
doc.url = this.getFileURL(doc);
|
||||
} */
|
||||
|
||||
if(oldDoc) {
|
||||
return Object.assign(oldDoc, doc);
|
||||
}
|
||||
|
||||
return doc;
|
||||
}
|
||||
|
||||
|
@ -479,6 +479,10 @@ export class ApiManager {
|
||||
setTimeout(() => {
|
||||
performRequest(cachedNetworker);
|
||||
}, options.waitTime * 1000);
|
||||
} else if(error.type === 'UNKNOWN') {
|
||||
setTimeout(() => {
|
||||
performRequest(cachedNetworker);
|
||||
}, 1000);
|
||||
} else {
|
||||
rejectPromise(error);
|
||||
}
|
||||
|
@ -4,11 +4,9 @@
|
||||
* https://github.com/morethanwords/tweb/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
import type { RequestFilePartTask, RequestFilePartTaskResponse } from "../serviceWorker/index.service";
|
||||
import { RefreshReferenceTask, RefreshReferenceTaskResponse } from "./apiFileManager";
|
||||
import type { ApiError } from "./apiManager";
|
||||
import appMessagesManager from "../appManagers/appMessagesManager";
|
||||
import { InputFileLocation, Photo } from "../../layer";
|
||||
import { Photo } from "../../layer";
|
||||
import { bytesToHex } from "../../helpers/bytes";
|
||||
import { deepEqual } from "../../helpers/object";
|
||||
import { MOUNT_CLASS_TO } from "../../config/debug";
|
||||
@ -61,9 +59,9 @@ class ReferenceDatabase {
|
||||
if(!contexts) {
|
||||
contexts = new Set();
|
||||
this.contexts.set(reference, contexts);
|
||||
this.links[bytesToHex(reference)] = reference;
|
||||
}
|
||||
|
||||
|
||||
this.links[bytesToHex(reference)] = reference;
|
||||
for(const _context of contexts) {
|
||||
if(deepEqual(_context, context)) {
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user