annotate commitwatcher/poller.py @ 42:cd590e1722d6

dup
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 05 Nov 2013 03:03:06 -0800
parents 630aaf102ce8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
32
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
1 """
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
2 poller/daemon-like service to continuously check the repo
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
3 """
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
4
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
5 import time
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
6
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
7 class CommitPoller(object):
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
8
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
9 def __init__(self, fetcher, period=300):
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
10 self.fetcher = fetcher
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
11 self.period = period
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
12
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
13 def poll(self):
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
14 """poll"""
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
15
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
16
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
17 def start(self):
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
18 """poll forever"""
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
19 while True:
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
20
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
21 __call__ = start