| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 from datetime import timedelta | 5 from datetime import timedelta |
| 6 | 6 |
| 7 from buildbot.changes.base import PollingChangeSource | 7 from buildbot.changes.base import PollingChangeSource |
| 8 from twisted.internet.defer import inlineCallbacks, returnValue | 8 from twisted.internet.defer import inlineCallbacks, returnValue |
| 9 | 9 |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 """ | 28 """ |
| 29 assert integrator | 29 assert integrator |
| 30 if isinstance(poll_interval, timedelta): | 30 if isinstance(poll_interval, timedelta): |
| 31 poll_interval = poll_interval.total_seconds() | 31 poll_interval = poll_interval.total_seconds() |
| 32 | 32 |
| 33 self.integrator = integrator | 33 self.integrator = integrator |
| 34 if poll_interval: | 34 if poll_interval: |
| 35 self.pollInterval = poll_interval | 35 self.pollInterval = poll_interval |
| 36 self.dry_run = dry_run | 36 self.dry_run = dry_run |
| 37 | 37 |
| 38 def describe(self): |
| 39 return 'BuildBucketPoller' |
| 40 |
| 38 @inlineCallbacks | 41 @inlineCallbacks |
| 39 def poll(self): | 42 def poll(self): |
| 40 # Do not schedule multiple polling processes at a time. | 43 # Do not schedule multiple polling processes at a time. |
| 41 if not self._polling and self.integrator.started and not self.dry_run: | 44 if not self._polling and self.integrator.started and not self.dry_run: |
| 42 self._polling = True | 45 self._polling = True |
| 43 try: | 46 try: |
| 44 yield self.integrator.poll_builds() | 47 yield self.integrator.poll_builds() |
| 45 finally: | 48 finally: |
| 46 self._polling = False | 49 self._polling = False |
| OLD | NEW |