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

executors PeriodicalExecutor can support add workers #4537

Open
munding opened this issue Jan 2, 2025 · 1 comment
Open

executors PeriodicalExecutor can support add workers #4537

munding opened this issue Jan 2, 2025 · 1 comment

Comments

@munding
Copy link

munding commented Jan 2, 2025

A periodic executor performing I/O operations like HTTP reporting can easily cause data accumulation. Adding an option to set the number of workers during the creation of a new PeriodicalExecutor can help.

周期性 Executor 在执行一些 io 操作,比如 http 上报,很容易造成数据堆积,在 New PeriodicalExecutor 的过程中可以选择添加 worker 数量的选项

@kevwan
Copy link
Contributor

kevwan commented Jan 2, 2025

You can decide how to run tasks, because TaskContainer interface let you write your own execution logic.

	// TaskContainer interface defines a type that can be used as the underlying
	// container that used to do periodical executions.
	TaskContainer interface {
		// AddTask adds the task into the container.
		// Returns true if the container needs to be flushed after the addition.
		AddTask(task any) bool
		// Execute handles the collected tasks by the container when flushing.
		Execute(tasks any)
		// RemoveAll removes the contained tasks, and return them.
		RemoveAll() any
	}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants