← Back to context

Comment by Veserv

2 days ago

The original loop is:

while (time() != timeout) {;}

The fixed loop is:

while (time() < timeout) {;}

I see. I did not realize SECONDS was a built in bash variable.

  • It is still not a proper fix. It is still busy-looping 100% CPU.

    Given that Github Actions is quite popular, probably wasting large amount of energy.

    But probably good at generating billable Actions minutes.

    One can only hope that not many people use sleeps to handle their CI race conditions, as that itself is also not a proper fix.

    • Yeah, definitely not a proper fix.

      Maybe a more serious fix is something like "read -t $N". If you think stdin might not be usable (like maybe it will close prematurely) this option won't work, but maybe you can open an anonymous FD and read from it instead.

      2 replies →

  • Me neither. I am over 40 and did not know this. Feels good to learn something today, in an unexpected place!