Skip to content

Commit

Permalink
(fixes buildbot#645) remove tail recursion
Browse files Browse the repository at this point in the history
  • Loading branch information
Dustin J. Mitchell committed Dec 19, 2009
1 parent 0c51ff9 commit fb70a1d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions contrib/git_buildbot.py
Expand Up @@ -60,7 +60,7 @@ def connectFailed(error):
return error


def addChange(dummy, remote, changei):
def addChange(remote, changei):
logging.debug("addChange %s, %s" % (repr(remote), repr(changei)))
try:
c = changei.next()
Expand All @@ -73,12 +73,17 @@ def addChange(dummy, remote, changei):
logging.debug(" %s: %s" % (key, value))

d = remote.callRemote('addChange', c)
d.addCallback(addChange, remote, changei)

# tail recursion in Twisted can blow out the stack, so we
# insert a callLater to delay things
def recurseLater(x):
reactor.callLater(0, addChange, remote, changei)
d.addCallback(recurseLater)
return d


def connected(remote):
return addChange(None, remote, changes.__iter__())
return addChange(remote, changes.__iter__())


def grab_commit_info(c, rev):
Expand Down

0 comments on commit fb70a1d

Please sign in to comment.