[TASK] Use setImmediate instead of setTimeout.