Skip to content

Commit

Permalink
Add sleep() to reduce CPU utilization percentage.
Browse files Browse the repository at this point in the history
  • Loading branch information
bharadwajyarlagadda committed Jun 14, 2017
1 parent 84f8a49 commit 52b01fe
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions finder/api.py
Expand Up @@ -3,6 +3,7 @@
import os
import queue
import threading
import time

from .schema import FinderSchema, DataSchema, ErrorSchema
from .utils import search, iterfiles
Expand Down Expand Up @@ -96,6 +97,10 @@ def find(*paths, **kwargs):
reader.start()
reader.join()

# Sleep call reduces the CPU utilization percentage. If CPU
# performance is not a concern, this line can be commented out.
time.sleep(0.03)

while not _queue.empty():
yield _queue.get()

Expand Down

0 comments on commit 52b01fe

Please sign in to comment.