wibu-systems / docker-codemeter

0 stars 0 forks source link

Improve Service Start Waiting Mechanism #3

Open debuggin opened 2 months ago

debuggin commented 2 months ago

We have identified a potential improvement in the service start waiting mechanism currently implemented in the project. The current approach uses a fixed sleep duration, as shown below:

sleep 1.5

This method, while straightforward, may not be optimal as it relies on an arbitrary time delay which might not always be sufficient or efficient under varying conditions.

We propose a more dynamic and robust solution to ensure the service has started properly before proceeding. The suggested approach involves checking the service status in a loop until it is confirmed to be running, as illustrated below:

until [ "$(cmu --list | grep -i 'not running')" = "" ]; do
    sleep 1;
done

This method continuously checks the service status and only proceeds once the service is confirmed to be running, thus improving reliability.

We believe this enhancement will provide a more robust solution to handle service start verification, accommodating varying startup times and ensuring the service is genuinely ready.

Thank you for considering this suggestion.

y-seq commented 2 months ago

The arbitrary delay is indeed not very fail proof and does not account for most cases. Internally we willt track this as FB32-100079