Skip to content

[BUG] Incorrect typing of register_timer and register_reminder #802

@lor1113

Description

@lor1113

Expected Behavior

As specified in https://docs.dapr.io/developing-applications/building-blocks/actors/actors-timers-reminders/, period is an optional parameter. Therefore the python SDK methods should reflect that. However in both functions period is type hinted as a mandatory timedelta

    async def register_reminder(
        self,
        name: str,
        state: bytes,
        due_time: timedelta,
        period: timedelta,
        ttl: Optional[timedelta] = None,
    async def register_timer(
        self,
        name: Optional[str],
        callback: TIMER_CALLBACK,
        state: Any,
        due_time: timedelta,
        period: timedelta,
        ttl: Optional[timedelta] = None,

I have confirmed that if you send None to period and just ignore the type error, everything functions fine according to the specified behaviour of the timer/reminder firing once.

Actual Behavior

In both functions period should be type hint as follows

period: Optional[timedelta]

or perhaps

period: Optional[timedelta] = None,

RELEASE NOTE: It's so minor I don't think it deserves one tbh, but it should still be fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions