Skip to content
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

Implement Scheduler component #3299

Closed
4 tasks
Tracked by #3304
swift1337 opened this issue Dec 16, 2024 · 0 comments · Fixed by #3319
Closed
4 tasks
Tracked by #3304

Implement Scheduler component #3299

swift1337 opened this issue Dec 16, 2024 · 0 comments · Fixed by #3319
Labels
code-quality Code quality improvement refactor zetaclient Issues related to ZetaClient

Comments

@swift1337
Copy link
Contributor

swift1337 commented Dec 16, 2024

Don't confuse it with cctx scheduling

We have a lot of repeated logic where we want to run certain tasks in the background on a predefined interval. We might also want to skip certain runs (e.g., app.IsOutboundObservationEnabled()). Additionally, the interval can be changed dynamically.

For these use cases, we have bg and ticker packages, but we lack a combined component that also supports metric reporting per run (e.g., last run, latency, outcome, ...). Thus, it's very handy to have something like this:

type Task interface {
	// ...
}

type Scheduler interface {
	Register(Task, Opts...)
}

Each ObserverSigner would receive Scheduler in Start(ctx context.context, s Scheduler) error and register its jobs there

func (os *Solana) Start(ctx context.Context, s *scheduler.Scheduler) error {
   s.Register(os.observer.ObserverInbound, /* options... */)
   s.Register(os.observer.ObserveGasPrice, /* options... */)
   s.Register(os.ScheduleOutbounds, /* options... */)
   
   return nil
}

image

Tasks

Preview Give feedback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code-quality Code quality improvement refactor zetaclient Issues related to ZetaClient
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant