mirror of
https://github.com/TriliumNext/Notes.git
synced 2026-05-02 18:29:28 -05:00
reddit plugin configuration from file, not from options now. Scheduling, refactoring of sync mutex
This commit is contained in:
+16
-1
@@ -4,5 +4,20 @@
|
||||
*/
|
||||
|
||||
const Mutex = require('async-mutex').Mutex;
|
||||
const instance = new Mutex();
|
||||
|
||||
module.exports = new Mutex();
|
||||
async function doExclusively(func) {
|
||||
const releaseMutex = await instance.acquire();
|
||||
|
||||
try {
|
||||
await func();
|
||||
}
|
||||
finally {
|
||||
releaseMutex();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
doExclusively
|
||||
};
|
||||
Reference in New Issue
Block a user