Skip to content

Commit

Permalink
sleep to avoid busy waiting.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrobinAV committed Feb 22, 2024
1 parent bc4112c commit fdf4779
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions taipy/core/_orchestrator/_dispatcher/_job_dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# specific language governing permissions and limitations under the License.

import threading
import time
from abc import abstractmethod
from queue import Empty
from typing import Dict, Optional
Expand Down Expand Up @@ -69,6 +70,8 @@ def run(self):
break
job = self.orchestrator.jobs_to_run.get(block=True, timeout=0.1)
self._execute_job(job)
else:
time.sleep(0.1) # We need to sleep to avoid busy waiting.
except Empty: # In case the last job of the queue has been removed.
pass
except Exception as e:
Expand Down

0 comments on commit fdf4779

Please sign in to comment.