Repository: dapr/python-sdk

Issue:
ReminderData does not honours period value
## Expected Behavior

When registering an Actor's reminder it should honour the `period` argument's value, allowing us to schedule reminders.


## Actual Behavior

when receive_reminder() is called, `period` argument contains the `due_time` 'svalue. Also, reminder is called based on the `due_time`'s value instead of `period`'s value.


## Steps to Reproduce the Problem

Create an actor and register a reminder with different values for `due_time` and `period`. See that reminder is triggered after `due_time` has passed and every `due_time` instead of `period`.

It looks like the problem could be in [as_dict()](https://github.com/dapr/python-sdk/blob/04d838965344608f6021621995c50a1a5548f5a3/dapr/actor/runtime/_reminder_data.py#L77) method

## Release Note
<!-- How should the fix for this issue be communicated in our release notes? It can be populated later. -->
<!-- Keep it as a single line. Examples: -->

<!-- RELEASE NOTE: **ADD** New feature in Dapr. -->
<!-- RELEASE NOTE: **FIX** Bug in runtime. -->
<!-- RELEASE NOTE: **UPDATE** Runtime dependency. -->

RELEASE NOTE: **FIX** ReminderData does not honour period value


Comments:

Patch:
diff --git a/dapr/actor/runtime/_reminder_data.py b/dapr/actor/runtime/_reminder_data.py
index 2fcddfd..62cd202 100644
--- a/dapr/actor/runtime/_reminder_data.py
+++ b/dapr/actor/runtime/_reminder_data.py
@@ -74,7 +74,7 @@ class ActorReminderData:
         return {
             'reminderName': self._reminder_name,
             'dueTime': self._due_time,
-            'period': self._due_time,
+            'period': self._period,
             'data': encoded_state.decode("utf-8"),
         }
 
diff --git a/setup.cfg b/setup.cfg
index b930bad..c78c6eb 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -22,7 +22,7 @@ packages = find_namespace:
 include_package_data = True
 zip_safe = False
 install_requires =
-    protobuf == 3.13.0
+    protobuf == 3.17.3
     grpcio >= 1.26.0
     aiohttp >= 3.6.2
     python-dateutil >= 2.8.1


Test patch:
diff --git a/tests/actor/test_reminder_data.py b/tests/actor/test_reminder_data.py
index d1c506a..9cc10bb 100644
--- a/tests/actor/test_reminder_data.py
+++ b/tests/actor/test_reminder_data.py
@@ -18,11 +18,11 @@ class ActorReminderTests(unittest.TestCase):
                 'test_reminder',
                 123,  # int type
                 timedelta(seconds=1),
-                timedelta(seconds=1))
+                timedelta(seconds=2))
             ActorReminderData(
                 'test_reminder',
                 'reminder_state',  # string type
-                timedelta(seconds=1),
+                timedelta(seconds=2),
                 timedelta(seconds=1))
 
     def test_valid_state(self):
@@ -31,7 +31,7 @@ class ActorReminderTests(unittest.TestCase):
             'test_reminder',
             b'reminder_state',
             timedelta(seconds=1),
-            timedelta(seconds=1))
+            timedelta(seconds=2))
         self.assertEqual(b'reminder_state', reminder.state)
 
     def test_as_dict(self):
@@ -39,11 +39,11 @@ class ActorReminderTests(unittest.TestCase):
             'test_reminder',
             b'reminder_state',
             timedelta(seconds=1),
-            timedelta(seconds=1))
+            timedelta(seconds=2))
         expected = {
             'reminderName': 'test_reminder',
             'dueTime': timedelta(seconds=1),
-            'period': timedelta(seconds=1),
+            'period': timedelta(seconds=2),
             'data': 'cmVtaW5kZXJfc3RhdGU=',
         }
         self.assertDictEqual(expected, reminder.as_dict())
@@ -51,10 +51,10 @@ class ActorReminderTests(unittest.TestCase):
     def test_from_dict(self):
         reminder = ActorReminderData.from_dict('test_reminder', {
             'dueTime': timedelta(seconds=1),
-            'period': timedelta(seconds=1),
+            'period': timedelta(seconds=2),
             'data': 'cmVtaW5kZXJfc3RhdGU=',
         })
         self.assertEqual('test_reminder', reminder.reminder_name)
         self.assertEqual(timedelta(seconds=1), reminder.due_time)
-        self.assertEqual(timedelta(seconds=1), reminder.period)
+        self.assertEqual(timedelta(seconds=2), reminder.period)
         self.assertEqual(b'reminder_state', reminder.state)