-
Notifications
You must be signed in to change notification settings - Fork 261
OPDATA-5659 Improve PoR EA messaging for schedule-based data suppression #4689
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@chainlink/proof-of-reserves-adapter': minor | ||
| --- | ||
|
|
||
| Add clearer logging |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| import type { ExecuteWithConfig, InputParameters } from '@chainlink/ea-bootstrap' | ||
| import { Validator } from '@chainlink/ea-bootstrap' | ||
| import { Logger, Validator } from '@chainlink/ea-bootstrap' | ||
| import { Config } from '../config' | ||
| import { getValidAddresses } from '../utils/addressValidator' | ||
| import { | ||
|
|
@@ -140,9 +140,21 @@ export const execute: ExecuteWithConfig<Config> = async (input, context, config) | |
| const currentUTC = new Date() | ||
|
|
||
| if (currentUTC < startUTC || currentUTC > endUTC) { | ||
| throw new Error( | ||
| `Skipping request. Current UTC Hour: ${currentUTC} outside schedule window of start: ${startUTC} and end: ${endUTC}`, | ||
| ) | ||
| // Calculate next available window | ||
| const nextWindowStart = new Date(startUTC) | ||
| if (currentUTC > endUTC) { | ||
| // If we're past today's window, next window is tomorrow | ||
| nextWindowStart.setUTCDate(nextWindowStart.getUTCDate() + 1) | ||
| } | ||
|
|
||
| const message = | ||
| `Skipping execution - outside schedule window. ` + | ||
| `JobRunId: ${jobRunID}, ` + | ||
| `Current: ${currentUTC.toISOString()}, ` + | ||
| `Window: [${startUTC.toISOString()} - ${endUTC.toISOString()}], ` + | ||
| `NextWindowStart: ${nextWindowStart.toISOString()}` | ||
| Logger.info(message) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will log every 10 seconds while the window is closed, right? Isn't that a lot of log spam?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is. I can remove the logging and just it in the error message. |
||
| throw new Error(message) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this cause a 400 or 500 error? Do we want to use an |
||
| } | ||
| } | ||
|
|
||
|
|
||
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.
Can you add a test?