Skip to content
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

Make created_at utc in topic writer #529

Merged
merged 1 commit into from
Dec 11, 2024
Merged
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
2 changes: 1 addition & 1 deletion ydb/_topic_reader/topic_reader_asyncio_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ async def test_free_buffer_after_partition_stop(self, stream, stream_reader, par
initial_buffer_size = stream_reader._buffer_size_bytes
message_size = initial_buffer_size - 1

t = datetime.datetime.now()
t = datetime.datetime.now(datetime.timezone.utc)

stream.from_server.put_nowait(
StreamReadMessage.FromServer(
Expand Down
2 changes: 1 addition & 1 deletion ydb/_topic_writer/topic_writer_asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ def _add_messages_to_send_queue(self, internal_messages: List[InternalMessage]):

def _prepare_internal_messages(self, messages: List[PublicMessage]) -> List[InternalMessage]:
if self._settings.auto_created_at:
now = datetime.datetime.now()
now = datetime.datetime.now(datetime.timezone.utc)
else:
now = None

Expand Down
8 changes: 4 additions & 4 deletions ydb/_topic_writer/topic_writer_asyncio_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ async def test_init_writer(self, stream):

async def test_write_a_message(self, writer_and_stream: WriterWithMockedStream):
data = "123".encode()
now = datetime.datetime.now()
now = datetime.datetime.now(datetime.timezone.utc)
writer_and_stream.writer.write(
[
InternalMessage(
Expand Down Expand Up @@ -322,7 +322,7 @@ async def test_reconnect_and_resent_non_acked_messages_on_retriable_error(
get_stream_writer,
default_write_statistic,
):
now = datetime.datetime.now()
now = datetime.datetime.now(datetime.timezone.utc)
data = "123".encode()

message1 = PublicMessage(
Expand Down Expand Up @@ -460,7 +460,7 @@ async def test_deny_double_seqno(self, reconnector: WriterAsyncIOReconnector, ge

@freezegun.freeze_time("2022-01-13 20:50:00", tz_offset=0)
async def test_auto_created_at(self, default_driver, default_settings, get_stream_writer):
now = datetime.datetime.now()
now = datetime.datetime.now(datetime.timezone.utc)

settings = copy.deepcopy(default_settings)
settings.auto_created_at = True
Expand Down Expand Up @@ -587,7 +587,7 @@ async def test_custom_encoder(self, default_driver, default_settings, get_stream
settings.codec = codec
reconnector = WriterAsyncIOReconnector(default_driver, settings)

now = datetime.datetime.now()
now = datetime.datetime.now(datetime.timezone.utc)
seqno = self.init_last_seqno + 1

await reconnector.write_with_ack_future([PublicMessage(data=b"123", seqno=seqno, created_at=now)])
Expand Down
Loading