Skip to content

Replace datetime.strptime for find_task_timer_created() #228

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 2, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions azure/durable_functions/tasks/task_utilities.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import json
from ..models.history import HistoryEventType, HistoryEvent
from ..constants import DATETIME_STRING_FORMAT
from azure.functions._durable_functions import _deserialize_custom_object
from datetime import datetime
from dateutil import parser
from typing import List, Optional
from ..models.actions.Action import Action
from ..models.Task import Task
Expand Down Expand Up @@ -140,7 +139,7 @@ def find_task_timer_created(state, fire_at):
tasks = []
for e in state:
if e.event_type == HistoryEventType.TIMER_CREATED and hasattr(e, "FireAt"):
if datetime.strptime(e.FireAt, DATETIME_STRING_FORMAT) == fire_at:
if parser.parse(e.FireAt).replace(tzinfo=None) == fire_at:
tasks.append(e)

if len(tasks) == 0:
Expand Down