makes icon indicating copy to clipboard operation
makes copied to clipboard

Asynchronous signal for processes orchestration

Open kamadorueda opened this issue 4 years ago • 1 comments

On a bash script, you sometimes require to send jobs to the background. If you want that background process to somehow signal that it's finished its setup and it's ready for the main process to use one of good idea is to make the background process bind to a port that acts as a signal to the main process. The main process can simply wait on such process to open (#686) asynchronously and then continue.

Example usage:

  • The main process starts an S3 server on the background
  • The main process waits for port 19000 to open
  • The S3 server starts listening on port 9000
  • The S3 server does some initial setup
  • The S3 signals that it's ready and functional by opening port 19000
  • The main process resumes as port 19000 is done

As you can see, waiting for port 9000 directly is a bad idea, as the main script would continue working with a not-ready S3 server. Normally people here would a $ sleep. But this is worst as things take more/less depending on CPU speed, network bandwidth, kernel load factor, etc

Example implementation:

  • https://gitlab.com/fluidattacks/product/-/tree/708bb9d1662b8431c2439d540465c72167b9b719/makes/applications/makes/done

This contributes to a world where people do not perform processes orchestration with poorman's $ sleeps

kamadorueda avatar Oct 05 '21 04:10 kamadorueda

related to #686

dsalaza4 avatar Jun 13 '23 20:06 dsalaza4