reddit plugin configuration from file, not from options now. Scheduling, refactoring of sync mutex

This commit is contained in:
azivner
2018-01-13 22:51:39 -05:00
parent fbfaff6ab8
commit 9839ea019e
5 changed files with 63 additions and 49 deletions

View File

@@ -20,25 +20,25 @@ let proxyToggle = true;
let syncServerCertificate = null;
async function sync() {
const releaseMutex = await sync_mutex.acquire();
try {
if (!await sql.isDbUpToDate()) {
return {
success: false,
message: "DB not up to date"
};
}
await sync_mutex.doExclusively(async () => {
if (!await sql.isDbUpToDate()) {
return {
success: false,
message: "DB not up to date"
};
}
const syncContext = await login();
const syncContext = await login();
await pushSync(syncContext);
await pushSync(syncContext);
await pullSync(syncContext);
await pullSync(syncContext);
await pushSync(syncContext);
await pushSync(syncContext);
await checkContentHash(syncContext);
await checkContentHash(syncContext);
});
return {
success: true
@@ -64,9 +64,6 @@ async function sync() {
}
}
}
finally {
releaseMutex();
}
}
async function login() {