-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bucket notification - ignore failure if notification was removed #8709
Conversation
if (this.nc_config_fs) { | ||
bucket = await this.nc_config_fs.get_bucket_by_name(notif.meta.bucket); | ||
} else { | ||
const system = this.system_store.data.systems[0]; |
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.
Line number 71 and 72 suggest that system could be null. So better check it here also?
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.
If system is null
, then _can_run() will return false and bg worker will not run (and we will not get to handle_failed_notification() where I don't check is system is not null).
if (send_promise) send_promises.push(send_promise); | ||
if (send_promises.length > this.batch_size) { | ||
await Promise.all(send_promises); | ||
send_promises = []; | ||
} | ||
} catch (err) { | ||
dbg.error("Failed to notify. err = ", err, ", str =", str); | ||
await failure_append(str); | ||
//re-write the failed notification if it's still configured on the bucket | ||
if (notif) { |
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.
No need of this check.
"notif" will not be null at this point. If it could be, then we should have checked it before line no 124.
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.
notif can be null in case json parsing fails (currently line 123).
If json parsing is ok, notif will not be null on 124 and forward.
4825980
to
f5817e1
Compare
Signed-off-by: Amit Prinz Setter <[email protected]>
f5817e1
to
7167ef2
Compare
…baa#8709) Signed-off-by: Amit Prinz Setter <[email protected]>
Explain the changes
Now they are re-written only if they are still configured on the bucket.
Issues: Fixed #xxx / Gap #xxx
Testing Instructions: