Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Submit on FM startup #119

Merged
merged 3 commits into from
Mar 30, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions services/fluxmonitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ func (fm *FluxMonitor) eventListener(ch <-chan interface{}) {
}

func (fm *FluxMonitor) canSubmitToRound(initiate bool) bool {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

if !fm.state.CanSubmit {
logger.Info("Oracle can't submit to this feed")

Expand Down Expand Up @@ -256,6 +257,7 @@ func (fm *FluxMonitor) hitTrigger() {

func (fm *FluxMonitor) startPoller() {
fm.poll()
fm.checkAndSendJob(false)
Copy link
Contributor

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.

Copy link
Author

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?

Copy link
Contributor

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.

ticker := time.NewTicker(fm.config.PollInterval)
defer ticker.Stop()

Expand Down