Skip to content

Commit

Permalink
Desktop: Disable plugin throttling for now
Browse files Browse the repository at this point in the history
  • Loading branch information
laurent22 committed Jan 19, 2022
1 parent c668bb0 commit 6bb0318
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
15 changes: 11 additions & 4 deletions packages/app-desktop/services/plugins/BackOffHandler.ts
@@ -1,5 +1,4 @@
import Logger from '@joplin/lib/Logger';
import time from '@joplin/lib/time';

const logger = Logger.create('BackOffHandler');

Expand Down Expand Up @@ -52,13 +51,21 @@ export default class BackOffHandler {

this.waitCount_++;

logger.warn(`Plugin ${this.pluginId_}: Applying a backoff of ${interval} seconds due to frequent plugin API calls. Consider reducing the number of calls, caching the data, or requesting more data per call. API call was: `, path, args, `[Wait count: ${this.waitCount_}]`);
// For now don't actually apply a backoff and don't abort.

if (this.waitCount_ > this.maxWaitCount_) throw new Error(`Plugin ${this.pluginId_}: More than ${this.maxWaitCount_} API alls are waiting - aborting. Please consider queuing the API calls in your plugins to reduce the load on the application.`);
logger.warn(`Plugin ${this.pluginId_}: Applying a backoff of ${interval} seconds due to frequent plugin API calls. Consider reducing the number of calls, caching the data, or requesting more data per call. API call was: `, path, args, `[Wait count: ${this.waitCount_}]`);

await time.sleep(interval);
if (this.waitCount_ > this.maxWaitCount_) logger.error(`Plugin ${this.pluginId_}: More than ${this.maxWaitCount_} API alls are waiting - aborting. Please consider queuing the API calls in your plugins to reduce the load on the application.`);

this.waitCount_--;



// if (this.waitCount_ > this.maxWaitCount_) throw new Error(`Plugin ${this.pluginId_}: More than ${this.maxWaitCount_} API alls are waiting - aborting. Please consider queuing the API calls in your plugins to reduce the load on the application.`);

// await time.sleep(interval);

// this.waitCount_--;
}

}
4 changes: 1 addition & 3 deletions packages/app-desktop/services/plugins/PluginRunner.ts
Expand Up @@ -160,10 +160,8 @@ export default class PluginRunner extends BasePluginRunner {
try {
await this.backOffHandler(plugin.id).wait(fullPath, debugMappedArgs);
} catch (error) {
// For now, we don't disable the plugin, but still print the
// errors so that any issue can be investigated easily.
logger.error(error);
// return;
return;
}

let result: any = null;
Expand Down

0 comments on commit 6bb0318

Please sign in to comment.