mirror of
https://github.com/zadam/trilium.git
synced 2025-11-02 11:26:15 +01:00
reddit plugin configuration from file, not from options now. Scheduling, refactoring of sync mutex
This commit is contained in:
@@ -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