From cfc26f627b0cfa1c523559812b3b6b841b0f368c Mon Sep 17 00:00:00 2001 From: Martin Karkowski Date: Fri, 15 Oct 2021 17:04:32 +0200 Subject: [PATCH] Adapting Changelog and fixing Warn element --- CHANGELOG.md | 4 ++++ lib/dispatcher/nopeDispatcher.ts | 9 +++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a3c278a..3e2cc55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.9.7.2 + +- Add a parameter for the `runNopeBackend` to select the default service provider selection method. + # 0.9.7.1 - If the Channel "event" is selected the "force-emitting" is enabled diff --git a/lib/dispatcher/nopeDispatcher.ts b/lib/dispatcher/nopeDispatcher.ts index 058e938..5e98189 100644 --- a/lib/dispatcher/nopeDispatcher.ts +++ b/lib/dispatcher/nopeDispatcher.ts @@ -269,6 +269,8 @@ export class nopeDispatcher implements INopeDispatcher { remove: number; }; + private __warned: boolean; + /** * Creates an instance of nopeDispatcher. * @param {nopeRpcDispatcherOptions} options The Options, used by the Dispatcher. @@ -303,6 +305,8 @@ export class nopeDispatcher implements INopeDispatcher { }; } + this.__warned = false; + if (RUNNINGINNODE) { const os = require("os"); @@ -2479,8 +2483,9 @@ export class nopeDispatcher implements INopeDispatcher { let _func = func; - if (!isAsyncFunction(func)) { - throw Error("Only Async Functions are allowed"); + if (!this.__warned && !isAsyncFunction(func)) { + this._logger.warn("!!! You have provided synchronous functions. They may break NoPE. Use them with care !!!"); + this.__warned = true; } if (options.deleteAfterCalling) {