@extensionmethod(Observable)
def throttle_first(self, window_duration, scheduler=None):

    scheduler = scheduler or timeout_scheduler
    duration = scheduler.to_timedelta(+window_duration or 0)
    if duration <= scheduler.to_timedelta(0):
        raise ValueError('window_duration cannot be less or equal zero.')

    source = self

    def subscribe(observer):
        last_on_next = [0]

        def on_next(x):
            emit = False
            now = scheduler.now()

            with self.lock:
                if not last_on_next[0] or now - last_on_next[0] >= duration:
                    last_on_next[0] = now
                    emit = True
            if emit:
                observer.on_next(x)

        return source.subscribe(on_next, observer.on_error, observer.on_completed)
    return AnonymousObservable(subscribe)
Testing GitHub close_submitted hook ping
dataset/ETHPy150Open ReactiveX/RxPY/rx/linq/observable/throttlefirst.py/throttle_first--crossover with--dataset/ETHPy150Open reviewboard/reviewboard/reviewboard/hostingsvcs/tests/test_github.py/GitHubTests.test_close_submitted_hook_ping