Skip to content

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

Open
@udipta

Description

@udipta

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)

Activity

sid-pandya

sid-pandya commented on Jun 18, 2022

@sid-pandya

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @udipta@sid-pandya

        Issue actions

          Infinite loop thread in 6_Queue Exercise food_ordering_system.py · Issue #56 · codebasics/data-structures-algorithms-python