[go: up one dir, main page]

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

feat(dot/sync): Improve worker pool #4198

Open
3 tasks
EclesioMeloJunior opened this issue Sep 24, 2024 · 0 comments · May be fixed by #4258
Open
3 tasks

feat(dot/sync): Improve worker pool #4198

EclesioMeloJunior opened this issue Sep 24, 2024 · 0 comments · May be fixed by #4258
Assignees
Labels
A-design issue requires design work to think about how it would best be accomplished. C-complex Complex changes across multiple modules. Possibly will require additional research. S-sync-westend related to particular network syncing.

Comments

@EclesioMeloJunior
Copy link
Member
EclesioMeloJunior commented Sep 24, 2024

Task summary

  • Currently, our sync worker pool contains few pitfals related to how we treat and use channels and goroutines
  • We need a better implementation that should be generic and robust enough to handle retries logic and maybe more broader use cases.

Few points that needs to be addressed

  • worker pool should handle tasks async or should it resolve all batch of tasks and then return?
  • setup a max amount of failures in the pool then we can just ignore the worker (forever? or during a timeout)
  • worker pool should be able to resolve if there's no workers or all workers failed to resolve the tasks

Proposed interface

by @timwu20

package pools

type Task any
type TaskID string
type TaskResult struct {
	ID         TaskID
	NumRetries uint // if we care
}
type Result any
type BatchStatus struct {
	Failed  map[TaskID]TaskResult
	Success map[TaskID]TaskResult
}
type WorkerPool interface {
	Results() chan Result
	SubmitBatch(tasks ...Task) (batchID string)
	GetBatch(batchID string) BatchStatus
	Shutdown() error // we impl graceful shutdown
}

// Retry, numWorkers, timeouts, etc.
type WorkerPoolOptions any

func NewWorkerPool(opts ...WorkerPoolOptions) WorkerPool {
	panic("unimpl")
}
@EclesioMeloJunior EclesioMeloJunior added A-design issue requires design work to think about how it would best be accomplished. C-complex Complex changes across multiple modules. Possibly will require additional research. S-sync-westend related to particular network syncing. labels Sep 24, 2024
@P1sar P1sar linked a pull request Nov 7, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-design issue requires design work to think about how it would best be accomplished. C-complex Complex changes across multiple modules. Possibly will require additional research. S-sync-westend related to particular network syncing.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants