(
        self,
        *,
        seconds=0,
        minutes=0,
        hours=0,
        days=0,
        also_run_immediately=False,
        **timedelta_extra,
    )
return wrapper
Call a coroutine at the specified interval

        This is a simple scheduling mechanism which you can use in your bus module to setup
        recurring tasks. For example:

            bus = lightbus.create()

            @bus.client.every(seconds=30)
            def my_func():
                print("Hello")

        This can also be used to decorate async functions. In this case the function will be awaited.

        Note that the timing is best effort and is not guaranteed. That being said, execution
        time is accounted for.

        See Also:

            @bus.client.schedule()
Call a coroutine at the specified interval
Call a coroutine at the specified interval
def every(
        self,
        *,
        seconds=0,
        minutes=0,
        hours=0,
        days=0,
        also_run_immediately=False,
        **timedelta_extra,
    ):
        """Call a coroutine at the specified interval

        This is a simple scheduling mechanism which you can use in your bus module to setup
        recurring tasks. For example:

            bus = lightbus.create()

            @bus.client.every(seconds=30)
            def my_func():
                print("Hello")

        This can also be used to decorate async functions. In this case the function will be awaited.

        Note that the timing is best effort and is not guaranteed. That being said, execution
        time is accounted for.

        See Also:

            @bus.client.schedule()
        """
        td = timedelta(seconds=seconds, minutes=minutes, hours=hours, days=days, **timedelta_extra)

        if td.total_seconds() == 0:
            raise InvalidSchedule(
                "The @bus.client.every() decorator must be provided with a non-zero time argument."
                " Ensure you are passing at least one time argument, and that it has a non-zero"
                " value."
            )

        # TODO: There is an argument that the backgrounding of this should be done only after
        #       on_start() has been fired. Otherwise this will be run before the on_start() setup
        #       has happened in cases where also_run_immediately=True.
        def wrapper(f):
            coroutine = call_every(  # pylint: assignment-from-no-return
                callback=f, timedelta=td, also_run_immediately=also_run_immediately
            )
            self.add_background_task(coroutine)
            return f

        return wrapper
def every ( self , * , seconds = 0 , minutes = 0 , hours = 0 , days = 0 , also_run_immediately = False , * * timedelta_extra , ) : td = timedelta ( seconds = seconds , minutes = minutes , hours = hours , days = days , * * timedelta_extra ) if td . total_seconds ( ) == 0 : raise InvalidSchedule ( "The @bus.client.every() decorator must be provided with a non-zero time argument." " Ensure you are passing at least one time argument, and that it has a non-zero" " value." ) # TODO: There is an argument that the backgrounding of this should be done only after #       on_start() has been fired. Otherwise this will be run before the on_start() setup #       has happened in cases where also_run_immediately=True. def wrapper ( f ) : coroutine = call_every ( # pylint: assignment-from-no-return callback = f , timedelta = td , also_run_immediately = also_run_immediately ) self . add_background_task ( coroutine ) return f return wrapper