refactor task_workers and event_workers.