-
-
Notifications
You must be signed in to change notification settings - Fork 281
[WIP] upload scheduled query metadata #504
Conversation
Process note: could you please target the |
query, | ||
connectionId, | ||
requestor, | ||
cronInterval = null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
out of curiosity, why setting the default to 'null'?
return 60; | ||
} else if (cronInterval === '*/5 * * * *') { | ||
return 60 * 5; | ||
} else if (cronInterval.match(/\S+? \* \* \* \*/)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this throws when cronInterval
is null
@briandennis Fixing the issue with diff --git a/backend/utils/cronUtils.js b/backend/utils/cronUtils.js
index f9ce325..c896996 100644
--- a/backend/utils/cronUtils.js
+++ b/backend/utils/cronUtils.js
@@ -23,14 +23,16 @@ export function mapRefreshToCron (refreshInterval) {
}
export function mapCronToRefresh (cronInterval) {
- if (cronInterval === '* * * * *') {
- return 60;
- } else if (cronInterval === '*/5 * * * *') {
- return 60 * 5;
- } else if (cronInterval.match(/\S+? \* \* \* \*/)) {
- return 60 * 60;
- } else if (cronInterval.match(/\S+? \S+? \* \* \*/)) {
- return 60 * 60 * 24;
+ if (cronInterval) {
+ if (cronInterval === '* * * * *') {
+ return 60;
+ } else if (cronInterval === '*/5 * * * *') {
+ return 60 * 5;
+ } else if (cronInterval.match(/\S+? \* \* \* \*/)) {
+ return 60 * 60;
+ } else if (cronInterval.match(/\S+? \S+? \* \* \*/)) {
+ return 60 * 60 * 24;
+ }
}
// default to weekly
@@ -47,4 +49,4 @@ function computeMinutes (now) {
}
return minutes.join(',');
-}
\ No newline at end of file
+} While testing sometimes I get: When this happens, I restart Falcon and indeed the query has been deleted (as one would expect when the associated grid has been deleted). |
@briandennis And this fixes the issue that was causing diff --git a/backend/persistent/QueryScheduler.js b/backend/persistent/QueryScheduler.js
index 63375db..139db44 100644
--- a/backend/persistent/QueryScheduler.js
+++ b/backend/persistent/QueryScheduler.js
@@ -23,8 +23,6 @@ import {
updateGrid
} from './plotly-api.js';
-const DEFAULT_REFRESH_INTERVAL = 60 * 60 * 24 * 7;
-
class QueryScheduler {
constructor() {
this.scheduleQuery = this.scheduleQuery.bind(this);
@@ -100,7 +98,7 @@ class QueryScheduler {
requestor,
fid,
uids,
- refreshInterval: refreshInterval || DEFAULT_REFRESH_INTERVAL,
+ refreshInterval,
cronInterval,
query,
connectionId |
@briandennis Please, ignore my comment about the random errors caused by deleted grids. I was using a query left behind by the unit tests. |
note that the |
@nicolaskruchten please, ignore that screenshot, it was generated using a |
@briandennis do you need any help getting this guy over the finish line? |
@nicolaskruchten apologies for the delayed fixes here, was traveling these past few days. I believe the only remaining work is looking into whether or not the metadata request failure leaves the grid in a recoverable state. Investigating that now... |
backend/persistent/QueryScheduler.js
Outdated
@@ -100,7 +98,7 @@ class QueryScheduler { | |||
requestor, | |||
fid, | |||
uids, | |||
refreshInterval: refreshInterval || DEFAULT_REFRESH_INTERVAL, | |||
refreshInterval: refreshInterval || mapCronToRefresh(cronInterval), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
After testing with a backend that purposely fails when updating metadata, here's what I've found: Creating a new scheduled query (
|
Generally, I think I would be OK with just letting the user know that something odd had happened with the metadata and that they should hit save again, instead of trying to roll things back etc. In case 1 there is no metadata, which means that the user can't edit the query from the webapp (meh, the Falcon UI is better) and that the grid isn't indexed as being 'live' (meh, not great but not the end of the world). In case 2 there is metadata which is wrong, so a user editing the query from the webapp would have an incorrect starting point. This is not great, but again we're going to be discouraging this pattern. In either case, informing the user and getting them to re-save is good enough I feel, given how rare we expect this situation to be. |
closes #503
TODO: