Content-Length: 251812 | pFad | http://github.com/codebasics/data-structures-algorithms-python/issues/56

FA Infinite loop thread in 6_Queue Exercise food_ordering_system.py · Issue #56 · codebasics/data-structures-algorithms-python · GitHub
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)

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

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: http://github.com/codebasics/data-structures-algorithms-python/issues/56

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy