Skip to content
Open
Show file tree
Hide file tree
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
10 changes: 6 additions & 4 deletions azure-kusto-ingest/azure/kusto/ingest/_resource_manager.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License
from datetime import datetime, timedelta
from datetime import datetime, timedelta, timezone
from typing import List, Dict
from urllib.parse import urlparse

Expand Down Expand Up @@ -85,7 +85,8 @@ def __set_throttling_settings(self, num_of_attempts: int = 4, max_seconds_per_re
def _refresh_ingest_client_resources(self):
if (
not self._ingest_client_resources
or (self._ingest_client_resources_last_update + self._refresh_period) <= datetime.utcnow()
or (self._ingest_client_resources_last_update + self._refresh_period)
<= datetime.now(tz=timezone.utc)
or not self._ingest_client_resources.is_applicable()
):
self._ingest_client_resources = self._get_ingest_client_resources_from_service()
Expand Down Expand Up @@ -119,10 +120,11 @@ def _refresh_authorization_context(self):
if (
not self._authorization_context
or self._authorization_context.isspace()
or (self._authorization_context_last_update + self._refresh_period) <= datetime.utcnow()
or (self._authorization_context_last_update + self._refresh_period)
<= datetime.now(tz=timezone.utc)
):
self._authorization_context = self._get_authorization_context_from_service()
self._authorization_context_last_update = datetime.utcnow()
self._authorization_context_last_update = datetime.now(tz=timezone.utc)

def _get_authorization_context_from_service(self):
# trace all calls to get identity token
Expand Down
6 changes: 4 additions & 2 deletions azure-kusto-ingest/azure/kusto/ingest/ingestion_blob_info.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License
import json
from datetime import datetime
from datetime import datetime, timezone
from typing import TYPE_CHECKING

if TYPE_CHECKING:
Expand All @@ -28,7 +28,9 @@ def __init__(
self.properties["IgnoreSizeLimit"] = False
self.properties["ReportLevel"] = ingestion_properties.report_level.value
self.properties["ReportMethod"] = ingestion_properties.report_method.value
self.properties["SourceMessageCreationTime"] = datetime.utcnow().isoformat()
self.properties["SourceMessageCreationTime"] = datetime.now(
tz=timezone.utc
).isoformat()
self.properties["Id"] = str(blob_descriptor.source_id)
self.properties["ApplicationForTracing"] = application_for_tracing
self.properties["ClientVersionForTracing"] = client_version_for_tracing
Expand Down