Closed logicminds closed 8 years ago
I think it depends on whether it's an orchestration hook (e.g. host create) or Rails callback hook (e.g. after_create).
Orchestration tasks are run in a separate thread inside Foreman and the UI shows a progress bar when creating (and possibly updating) hosts, though it isn't displayed when deleting hosts. I think you'd be OK to block here.
Rails callbacks would block UI and API changes, so a ten minute wait would be excessive and possibly time out the HTTP request.
foreman_hooks has no backgrounding capability itself, but there's a foreman-tasks library which can be used by other plugins to background tasks in another process. Writing your own plugin to use tasks is an option, or perhaps foreman-hooks could have some way to run certain hooks via tasks (probably needs some way to add configuration to a hook file).
What happens when a create hook script takes 10 minutes to complete? Does the hook get backgrounded? Would the UI block on the script? Aside from backgrounding the system command used inside the script is there a better way to wait for tasks without hanging the UI?