From ce19b6b10c48eacee5179628294d062f78840a89 Mon Sep 17 00:00:00 2001 From: infacc Date: Fri, 21 Jul 2023 13:57:40 +0200 Subject: [PATCH] fix misspelling of 'interval' --- README.md | 2 +- main.bal | 44 ++++++++++++++++++++++---------------------- result-watcher.bal | 18 +++++++++--------- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 910cd7f..cd4a255 100644 --- a/README.md +++ b/README.md @@ -100,7 +100,7 @@ Environment variables to configure the backend with: | QHANA_PORT | `9090` | The port where the backend listens. | | QHANA_HOST | `http://localhost:9090` | The host base url of the backend including protocol and port. | | QHANA_CORS_DOMAINS | `http://localhost:4200` | Domains for which cors requests are allowed. Entries are separated by any whitespace. | -| QHANA_WATCHER_INTERVALLS | `1 10 10 5 60` | Configuration for the result watcher intervalls. Event entries are intervalls (in seconds) and odd entries specify after how many iterations the next intervall in the list is used. | +| QHANA_WATCHER_INTERVALS | `1 10 10 5 60` | Configuration for the result watcher intervals. Event entries are intervals (in seconds) and odd entries specify after how many iterations the next interval in the list is used. | | QHANA_URL_MAPPING | `{"(?<=^\|https?://)localhost(:[0-9]+)?": "host.docker.internal$1"}` | A map of rewrite rules for plugin result URLs. The map is a JSON object whose keys are regex patterns and whose values are the replacement strings for these patterns. All rules are applied to an URL without a guaranteed order. | | LOCALHOST_PROXY_PORTS | `:1234 :2345` | Alternative to QHANA_URL_MAPPING that can be used with the docker container. Forwards requests that go to the specified ports to the host machine. | QHANA_PLUGINS | `["http://localhost:5005/plugins/hello-world@v0-1-0/", "http://localhost:5005/plugins/entity-filter@v0-1-0/"]` | A list (JSON list/array) of plugin URLs. | diff --git a/main.bal b/main.bal index febc9e6..d7f3840 100644 --- a/main.bal +++ b/main.bal @@ -99,12 +99,12 @@ function getHost() returns string { # The final configured server host. final string & readonly serverHost = getHost().cloneReadOnly(); -# User configurable watcher intervall configuration. -# Can also be configured by setting the `QHANA_WATCHER_INTERVALLS` environment variable. -# The numbers are interpreted as folowing: `[, []]*` -# If the list ends with an intervall, i.e., the iterations count is missing, then the intervall +# User configurable watcher interval configuration. +# Can also be configured by setting the `QHANA_WATCHER_INTERVALS` environment variable. +# The numbers are interpreted as folowing: `[, []]*` +# If the list ends with an interval, i.e., the iterations count is missing, then the interval # will be repeated indefinitely. -configurable (decimal|int)[] watcherIntervallConfig = [2, 10, 5, 10, 10, 60, 30, 20, 60, 10, 600]; +configurable (decimal|int)[] watcherIntervalConfig = [2, 10, 5, 10, 10, 60, 30, 20, 60, 10, 600]; # Coerce the string input to a positive int or decimal. # @@ -122,25 +122,25 @@ function coerceToPositiveNumber(string input) returns decimal|int|error { return error(string `Input "${input}" is not a positive number!`); } -# Get the watcher intervalls from the `QHANA_WATCHER_INTERVALLS` environment variable. -# If not present use the configurable variable `watcherIntervallConfig` as fallback. +# Get the watcher intervals from the `QHANA_WATCHER_INTERVALS` environment variable. +# If not present use the configurable variable `watcherIntervalConfig` as fallback. # -# + return - the configured watcher intervalls -function getWatcherIntervallConfig() returns (decimal|int)[] { - string intervalls = os:getEnv("QHANA_WATCHER_INTERVALLS"); - if (intervalls.length() > 0) { +# + return - the configured watcher intervals +function getWatcherIntervalConfig() returns (decimal|int)[] { + string intervals = os:getEnv("QHANA_WATCHER_INTERVALS"); + if (intervals.length() > 0) { do { - return from string i in regex:split(intervalls, "[\\s\\(\\),;]+") + return from string i in regex:split(intervals, "[\\s\\(\\),;]+") select check coerceToPositiveNumber(i); } on fail error err { - log:printError("Failed to parse environment variable QHANA_WATCHER_INTERVALLS!\n", 'error = err, stackTrace = err.stackTrace()); + log:printError("Failed to parse environment variable QHANA_WATCHER_INTERVALS!\n", 'error = err, stackTrace = err.stackTrace()); } } - return watcherIntervallConfig; + return watcherIntervalConfig; } -# The final configured watcher intervalls. -final (decimal|int)[] & readonly configuredWatcherIntervalls = getWatcherIntervallConfig().cloneReadOnly(); +# The final configured watcher intervals. +final (decimal|int)[] & readonly configuredWatcherIntervals = getWatcherIntervalConfig().cloneReadOnly(); # User configurable URL map which is used by the backend to rewrite URLs used by the result watchers. # Can also be configured by setting the `QHANA_URL_MAPPING` environment variable. @@ -153,7 +153,7 @@ configurable map & readonly internalUrlMap = {}; # Get the URL map from the `QHANA_URL_MAPPING` environment variable. # If not present use the configurable variable `internalUrlMap` as fallback. # -# + return - the configured watcher intervalls +# + return - the configured watcher intervals function getInternalUrlMap() returns map { string mapping = os:getEnv("QHANA_URL_MAPPING"); if (mapping.length() > 0) { @@ -191,7 +191,7 @@ configurable string[] pluginRunners = []; # Get preset plugin runner from the `QHANA_PLUGIN_RUNNERS` environment variable. # If not present use the configurable variable `pluginRunners` as fallback. # -# + return - the configured watcher intervalls +# + return - the configured watcher intervals function getPluginRunnersConfig() returns string[] { string pRunners = os:getEnv("QHANA_PLUGIN_RUNNERS"); if (pRunners.length() > 0) { @@ -210,7 +210,7 @@ final string[] & readonly preconfiguredPluginRunners = getPluginRunnersConfig(). # Get preset plugins from the `QHANA_PLUGINS` environment variable. # If not present use the configurable variable `plugins` as fallback. # -# + return - the configured watcher intervalls +# + return - the configured watcher intervals function getPluginsConfig() returns string[] { string pluginList = os:getEnv("QHANA_PLUGINS"); if (pluginList.length() > 0) { @@ -705,7 +705,7 @@ service / on new http:Listener(serverPort) { } do { ResultWatcher watcher = check new (createdStep.stepId); - check watcher.schedule(...configuredWatcherIntervalls); + check watcher.schedule(...configuredWatcherIntervals); } on fail error err { log:printError("Failed to start watcher.", 'error = err, stackTrace = err.stackTrace()); // if with return does not correctly narrow type for rest of function... this does. @@ -869,7 +869,7 @@ service / on new http:Listener(serverPort) { lock { watcher = check getResultWatcherFromRegistry(step.stepId); } - check watcher.schedule(...configuredWatcherIntervalls); + check watcher.schedule(...configuredWatcherIntervals); } on fail error err { log:printError("Failed to restart watcher.", 'error = err, stackTrace = err.stackTrace()); // if with return does not correctly narrow type for rest of function... this does. @@ -1283,7 +1283,7 @@ public function main() { var stepsToWatch = check database:getTimelineStepsWithResultWatchers(); foreach var stepId in stepsToWatch { ResultWatcher watcher = check new (stepId); - check watcher.schedule(...configuredWatcherIntervalls); + check watcher.schedule(...configuredWatcherIntervals); } check commit; } on fail error err { diff --git a/result-watcher.bal b/result-watcher.bal index 7c332bb..bc7efb6 100644 --- a/result-watcher.bal +++ b/result-watcher.bal @@ -376,7 +376,7 @@ isolated class ResultWatcherRescheduler { public isolated function execute() { log:printInfo(string `Reschedule watcher ${self.watcher.stepId} after new substep was found.`); // TODO: Probably needs to be changed in the future - (decimal|int)[] initialIntervals = configuredWatcherIntervalls; + (decimal|int)[] initialIntervals = configuredWatcherIntervals; error? err = self.watcher.schedule(...initialIntervals); if err != () { log:printError("Failed to reschedule watcher.", 'error = err, stackTrace = err.stackTrace()); @@ -479,7 +479,7 @@ public isolated class ResultWatcher { } } - # Unschedule the current repeating task and schedule self again with the new intervall. + # Unschedule the current repeating task and schedule self again with the new interval. # # + interval - the time in seconds # + maxCount - how often the task will be repeated max (-1 for infinite repeats) @@ -509,17 +509,17 @@ public isolated class ResultWatcher { # Schedule this background job periodically with the given interval in seconds. # # If more than one number is given every second number starting from the first is - # interpreted as an interval. The number following the intervall is the number of - # times this background job is scheduled with that intervall. If no number follows - # an intervall, then the job will not unschedule itself. + # interpreted as an interval. The number following the interval is the number of + # times this background job is scheduled with that interval. If no number follows + # an interval, then the job will not unschedule itself. # # If the number of times is exceeded, then the job will reschedule itself - # with the next intervall in the list. If no intervall is left, then the job + # with the next interval in the list. If no interval is left, then the job # will unschedule itself. # # Unschedules the job first if it was already scheduled. # - # + intervals - usage: `[intervall1, backoffCounter1, intervall2, backoffCounter2, ..., [intervallLast]]` + # + intervals - usage: `[interval1, backoffCounter1, interval2, backoffCounter2, ..., [intervalast]]` # + return - The error encountered while (re)scheduling this job (or parsing the intervals) public isolated function schedule(decimal|int... intervals) returns error? { if intervals.length() <= 0 { @@ -544,12 +544,12 @@ public isolated class ResultWatcher { self.scheduleIntervals = scheduleIntervals.clone().reverse(); self.backoffCounters = backoffCounters.clone().reverse(); - var startingIntervall = self.scheduleIntervals.pop(); // list always contains >1 entries at this point (see guard at top) + var startingInterval = self.scheduleIntervals.pop(); // list always contains >1 entries at this point (see guard at top) self.currentBackoffCounter = self.backoffCounters.length() > 0 ? self.backoffCounters.pop() : (); int? maxRuns = self.currentBackoffCounter; - check self.reschedule(startingIntervall, (maxRuns == ()) ? -1 : maxRuns + 1); + check self.reschedule(startingInterval, (maxRuns == ()) ? -1 : maxRuns + 1); } }