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


Discussion:
codecov[bot]: # [Codecov](https://codecov.io/gh/dapr/python-sdk/pull/272?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dapr) Report
> Merging [#272](https://codecov.io/gh/dapr/python-sdk/pull/272?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dapr) (2abafbc) into [master](https://codecov.io/gh/dapr/python-sdk/commit/04d838965344608f6021621995c50a1a5548f5a3?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dapr) (04d8389) will **decrease** coverage by `0.46%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/dapr/python-sdk/pull/272/graphs/tree.svg?width=650&height=150&src=pr&token=JTTIYXA9JP&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dapr)](https://codecov.io/gh/dapr/python-sdk/pull/272?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dapr)

```diff
@@            Coverage Diff             @@
##           master     #272      +/-   ##
==========================================
- Coverage   89.28%   88.81%   -0.47%     
==========================================
  Files          52       52              
  Lines        2155     2154       -1     
==========================================
- Hits         1924     1913      -11     
- Misses        231      241      +10     
```


| [Impacted Files](https://codecov.io/gh/dapr/python-sdk/pull/272?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dapr) | Coverage Δ | |
|---|---|---|
| [dapr/actor/runtime/\_reminder\_data.py](https://codecov.io/gh/dapr/python-sdk/pull/272/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dapr#diff-ZGFwci9hY3Rvci9ydW50aW1lL19yZW1pbmRlcl9kYXRhLnB5) | `100.00% <ø> (ø)` | |
| [ext/flask\_dapr/flask\_dapr/actor.py](https://codecov.io/gh/dapr/python-sdk/pull/272/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dapr#diff-ZXh0L2ZsYXNrX2RhcHIvZmxhc2tfZGFwci9hY3Rvci5weQ==) | `50.00% <0.00%> (-7.96%)` | :arrow_down: |
| [ext/dapr-ext-fastapi/dapr/ext/fastapi/actor.py](https://codecov.io/gh/dapr/python-sdk/pull/272/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dapr#diff-ZXh0L2RhcHItZXh0LWZhc3RhcGkvZGFwci9leHQvZmFzdGFwaS9hY3Rvci5weQ==) | `55.81% <0.00%> (-3.49%)` | :arrow_down: |
| [dapr/clients/grpc/client.py](https://codecov.io/gh/dapr/python-sdk/pull/272/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dapr#diff-ZGFwci9jbGllbnRzL2dycGMvY2xpZW50LnB5) | `91.19% <0.00%> (-0.06%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/dapr/python-sdk/pull/272?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dapr).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dapr)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/dapr/python-sdk/pull/272?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dapr). Last update [04d8389...2abafbc](https://codecov.io/gh/dapr/python-sdk/pull/272?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dapr). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dapr).


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)