im-kulikov/helium

Remove workers package

im-kulikov opened this issue · 1 comments

Is your feature request related to a problem? Please describe.
nope

Describe the solution you'd like
for the next release, drop workers package and mark it as a feature request

Describe alternatives you've considered
for now, we can replace workers with a service interface, for example

type worker struct {
	cancel context.CancelFunc
}

func (w *worker) job(ctx context.Context) {
	tick := time.NewTicker(time.Second)

loop:
	for {
		select {
		case <-ctx.Done():
			break loop
		case <-tick.C:
			fmt.Println("tick")
		}
	}

	tick.Stop()
}

func (w *worker) Start(ctx context.Context) error {
	ctx, w.cancel = context.WithCancel(ctx)

	go w.job(ctx)

	return nil
}

func (w *worker) Stop() error {
	w.cancel()

	return nil
}

func (w *worker) Name() string { return "example-worker" }

func newExampleWorker() service.Service {
	return new(worker)
}

Additional context
remove worker package starting from v0.14.0

After discussions with teams that use helium (offline/personal communication), as well as expecting feedback from the community, we decide to get rid of the worker package.

If you still need it, create a new issue and refer to this proposal.