Add ML logging (#1504)
This commit is contained in:
commit
ebc03b5a69
|
@ -211,7 +211,7 @@ class DownloadManagerImpl {
|
|||
this.thumbnailObjectURLPromises.set(file.id, thumbURLPromise);
|
||||
}
|
||||
let thumb = await this.thumbnailObjectURLPromises.get(file.id);
|
||||
if (!thumb) {
|
||||
if (!thumb && !localOnly) {
|
||||
this.thumbnailObjectURLPromises.delete(file.id);
|
||||
thumb = await this.getThumbnailForPreview(file, localOnly);
|
||||
}
|
||||
|
|
|
@ -201,6 +201,7 @@ class MLWorkManager {
|
|||
}
|
||||
|
||||
private async runMLSyncJob(): Promise<MLSyncJobResult> {
|
||||
try {
|
||||
// TODO: skipping is not required if we are caching chunks through service worker
|
||||
// currently worker chunk itself is not loaded when network is not there
|
||||
if (!navigator.onLine) {
|
||||
|
@ -230,6 +231,9 @@ class MLWorkManager {
|
|||
// TODO: redirect/refresh to gallery in case of session_expired, stop ml sync job
|
||||
|
||||
return jobResult;
|
||||
} catch (e) {
|
||||
logError(e, 'Failed to run MLSync Job');
|
||||
}
|
||||
}
|
||||
|
||||
public async startSyncJob() {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { expose, Remote, wrap } from 'comlink';
|
||||
import { WorkerSafeElectronClient } from '@ente/shared/electron/worker/client';
|
||||
import { addLocalLog } from '@ente/shared/logging';
|
||||
import { logError } from '../sentry';
|
||||
|
||||
export class ComlinkWorker<T extends new () => InstanceType<T>> {
|
||||
public remote: Promise<Remote<InstanceType<T>>>;
|
||||
|
@ -12,7 +13,10 @@ export class ComlinkWorker<T extends new () => InstanceType<T>> {
|
|||
this.worker = worker;
|
||||
|
||||
this.worker.onerror = (errorEvent) => {
|
||||
console.error('Got error event from worker', errorEvent);
|
||||
logError(Error(errorEvent.message), 'Got error event from worker', {
|
||||
errorEvent: JSON.stringify(errorEvent),
|
||||
name: this.name,
|
||||
});
|
||||
};
|
||||
addLocalLog(() => `Initiated ${this.name}`);
|
||||
const comlink = wrap<T>(this.worker);
|
||||
|
|
Loading…
Reference in a new issue