Factor out the interactions handler in the worker code.