summaryrefslogtreecommitdiff
path: root/lib/git/async/task.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2010-06-09 15:40:51 +0200
committerSebastian Thiel <byronimo@gmail.com>2010-06-09 15:40:51 +0200
commit07996a1a1e53ffdd2680d4bfbc2f4059687859a5 (patch)
treeae3e8d6fc5f322fb633bc8c8ef45a1eccb2a605b /lib/git/async/task.py
parent57a4e09294230a36cc874a6272c71757c48139f2 (diff)
downloadgitpython-07996a1a1e53ffdd2680d4bfbc2f4059687859a5.tar.gz
task: removed scheduled task support, which at some point was introduced to improve performance, but which now hinders performance, besides being unnecessary ;)
Diffstat (limited to 'lib/git/async/task.py')
-rw-r--r--lib/git/async/task.py33
1 files changed, 0 insertions, 33 deletions
diff --git a/lib/git/async/task.py b/lib/git/async/task.py
index 539b240f..be02cfe8 100644
--- a/lib/git/async/task.py
+++ b/lib/git/async/task.py
@@ -23,8 +23,6 @@ class OutputChannelTask(Node):
'_out_wc', # output write channel
'_exc', # exception caught
'_done', # True if we are done
- '_scheduled_items', # amount of scheduled items that will be processed in total
- '_slock', # lock for scheduled items
'fun', # function to call with items read
'min_count', # minimum amount of items to produce, None means no override
'max_chunksize', # maximium amount of items to process per process call
@@ -37,8 +35,6 @@ class OutputChannelTask(Node):
self._out_wc = None # to be set later
self._exc = None
self._done = False
- self._scheduled_items = 0
- self._slock = threading.Lock()
self.fun = fun
self.min_count = None
self.max_chunksize = 0 # note set
@@ -72,21 +68,6 @@ class OutputChannelTask(Node):
""":return: Exception caught during last processing or None"""
return self._exc
- def add_scheduled_items(self, count):
- """Add the given amount of scheduled items to this task"""
- self._slock.acquire()
- self._scheduled_items += count
- self._slock.release()
-
- def scheduled_item_count(self):
- """:return: amount of scheduled items for this task"""
- self._slock.acquire()
- try:
- return self._scheduled_items
- finally:
- self._slock.release()
- # END threadsafe return
-
def process(self, count=0):
"""Process count items and send the result individually to the output channel"""
items = self._read(count)
@@ -101,19 +82,12 @@ class OutputChannelTask(Node):
if self.apply_single:
for item in items:
rval = self.fun(item)
- # decrement afterwards, the its unscheduled once its produced
- self._slock.acquire()
- self._scheduled_items -= 1
- self._slock.release()
wc.write(rval)
# END for each item
else:
# shouldn't apply single be the default anyway ?
# The task designers should chunk them up in advance
rvals = self.fun(items)
- self._slock.acquire()
- self._scheduled_items -= len(items)
- self._slock.release()
for rval in rvals:
wc.write(rval)
# END handle single apply
@@ -122,13 +96,6 @@ class OutputChannelTask(Node):
# be sure our task is not scheduled again
self.set_done()
- # unschedule all, we don't know how many have been produced actually
- # but only if we don't apply single please
- if not self.apply_single:
- self._slock.acquire()
- self._scheduled_items -= len(items)
- self._slock.release()
- # END unschedule all
# PROBLEM: We have failed to create at least one item, hence its not
# garantueed that enough items will be produced for a possibly blocking