Skip to content

1. Безымянный Сергей Андреевич. 613 - #19

Closed
wre7 wants to merge 13 commits into
python-department:mainfrom
wre7:main
Closed

wre7 wants to merge 13 commits into
python-department:mainfrom
wre7:main

Conversation

@wre7

@wre7 wre7 commented Sep 23, 2026

Copy link
Copy Markdown

No description provided.

@github-actions github-actions Bot added the 613 label Sep 23, 2026
@wre7
wre7 force-pushed the main branch 2 times, most recently from 2917c8c to c0867d8 Compare October 2, 2026 13:04
Comment thread src/part1/constants.py
from time import time


CURRENT_EPOCH_MS: int = int(time() * 1000)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Константы вычисляются, когда делается import, то есть при обращении к CURRENT_EPOCH_MS вы всегда будете получать одно и тоже время, когда был сделан import constants

Comment thread src/part1/snowflake.py
# TODO: реализуйте функцию
return 0
snowflake_id: int = (
(timestamp_ms << (NODE_ID_BITS + SEQUENCE_ID_BITS))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вычисление сдвига дублировано в функции decode_timestamp_ms. Это может быть опасно, так как если логика поменяется, то надо будет исправлять в 2х местах, а это можно забыть, поэтому лучше было вынести вычисление в отдельную константу.
Пункт S1, минус балл.

@wre7 wre7 closed this Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants