Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite loop thread in 6_Queue Exercise food_ordering_system.py #56

Open
udipta opened this issue May 30, 2022 · 1 comment
Open

Infinite loop thread in 6_Queue Exercise food_ordering_system.py #56

udipta opened this issue May 30, 2022 · 1 comment

Comments

@udipta
Copy link

udipta commented May 30, 2022

https://github.com/codebasics/data-structures-algorithms-python/blob/master/data_structures/6_Queue/Exercise/food_ordering_system.py

Issue:

def serve_orders():
    time.sleep(1)
    while True:
        order = food_order_queue.dequeue()
        print("Now serving: ",order)
        time.sleep(2)

Proposed below:

def serve_orders():
    time.sleep(1)
    while not food_order_queue.is_empty():
        order = food_order_queue.dequeue()
        print("Now serving: ",order)
        time.sleep(2)
@sid-pandya
Copy link

Did you able to solve it by this method?
Please attach your solution if possible. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants