Skip to content

Commit 3432e11

Browse files
committed
Do not let the timer and PullReqState form an RC cycle.
Sometimes the RC cycle will cause spurious "Test timed out" messages even when the PR has been merged.
1 parent 486cbf8 commit 3432e11

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

homu/main.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from .git_helper import SSH_KEY_FILE
2323
import shlex
2424
import random
25+
import weakref
2526

2627
STATUS_TO_PRIORITY = {
2728
'success': 0,
@@ -343,7 +344,13 @@ def blocked_by_closed_tree(self):
343344
def start_testing(self, timeout):
344345
self.test_started = time.time() # FIXME: Save in the local database
345346
self.set_status('pending')
346-
timer = Timer(timeout, self.timed_out)
347+
348+
wm = weakref.WeakMethod(self.timed_out)
349+
def timed_out():
350+
m = wm()
351+
if m:
352+
m()
353+
timer = Timer(timeout, timed_out)
347354
timer.start()
348355
self.timeout_timer = timer
349356

0 commit comments

Comments
 (0)