func NewTaskHandler(ctx context.Context,
	stateManager statemanager.Saver,
	state dockerstate.TaskEngineState,
	client api.ECSClient) *TaskHandler {
	// Create a handler and start the periodic event drain loop
	taskHandler := &TaskHandler{
		ctx:                     ctx,
		tasksToEvents:           make(map[string]*taskSendableEvents),
		submitSemaphore:         utils.NewSemaphore(concurrentEventCalls),
		tasksToContainerStates:  make(map[string][]api.ContainerStateChange),
		stateSaver:              stateManager,
		state:                   state,
		client:                  client,
		minDrainEventsFrequency: minDrainEventsFrequency,
		maxDrainEventsFrequency: maxDrainEventsFrequency,
	}
	go taskHandler.startDrainEventsTicker()

	return taskHandler
}
func NewTaskHandler(ctx context.Context,
	stateManager statemanager.Saver,
	state dockerstate.TaskEngineState,
	client api.ECSClient) *TaskHandler {
	// Create a handler and start the periodic event drain loop
	taskHandler := &TaskHandler{
		ctx:                     ctx,
		tasksToEvents:           make(map[string]*taskSendableEvents),
		submitSemaphore:         utils.NewSemaphore(concurrentEventCalls),
		tasksToContainerStates:  make(map[string][]api.ContainerStateChange),
		stateSaver:              stateManager,
		state:                   state,
		client:                  client,
		minDrainEventsFrequency: minDrainEventsFrequency,
		maxDrainEventsFrequency: maxDrainEventsFrequency,
	}
	go taskHandler.startDrainEventsTicker()

	return taskHandler
}
// NewTaskHandler returns a pointer to TaskHandler