-
Notifications
You must be signed in to change notification settings - Fork 46
Conversation
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.
The reason we can't send a job request after the first polling finishes is that it would get too expensive for the node operator for stale reports. Don't really want to the node ops to waste a few hundred $$ just for restarting their EI 😅
services/fluxmonitor.go
Outdated
@@ -179,6 +179,7 @@ func (fm *FluxMonitor) eventListener(ch <-chan interface{}) { | |||
} | |||
|
|||
func (fm *FluxMonitor) canSubmitToRound(initiate bool) bool { | |||
|
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.
services/fluxmonitor.go
Outdated
@@ -256,6 +257,7 @@ func (fm *FluxMonitor) hitTrigger() { | |||
|
|||
func (fm *FluxMonitor) startPoller() { | |||
fm.poll() | |||
fm.checkAndSendJob(false) |
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.
We should probably move this to FM startup and when eligibility to submit changes. Although we haven't gotten that far yet, there will be cases where the poller is disabled - so we can't always rely on this to be triggered.
I'll make a new issue for making the poll interval and heartbeat "optional" - but for now I think we should just move this to the FM startup and when the FA state is updated to make the oracle eligible to submit.
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.
But if we call it in an earlier state than here, before polling has started(e.g near the 1st call of canSubmitUpdated
), we wont't have a result to send, right?
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.
Right, so that function will see that it doesn't have any recent results and do it's own poll to get the latest median.
services/fluxmonitor.go
Outdated
if fm.latestResult.IsZero() { | ||
logger.Warn("Polling because result is zero") | ||
err := fm.poll() | ||
if err != nil { | ||
logger.Error("cannot retrieve result from polling") | ||
return err | ||
} | ||
} | ||
|
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 shouldn't be necessary, since we're checking the age of the result just below this (L227). If this hasn't been set - it's always going to trigger a new poll.
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.
True + it will start having an actual functionality :)
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.
Yep 👍
91f813e
to
0185493
Compare
Regarding #117, how about always sending a job request after first results from polling?