Repository navigation
4. Дьяков Григорий Александрович. 614 - #60
Open
dyakovgregory-bot wants to merge 9 commits into
Open
dyakovgregory-bot wants to merge 9 commits into
dyakovgregory-bot wants to merge 9 commits into
Conversation
EvgrafovMichail
left a comment
Member
There was a problem hiding this comment.
В целом решение аккуратное. Но из-за неверное реализации read_current_millis часть тестов не проходит.
Итог: 6/10
| """ | ||
| # TODO: реализуйте функцию | ||
| return 0 | ||
| return (snowflake_id >> (NODE_ID_MAX + SEQUENCE_ID_MAX)) + epoch_ms |
Member
There was a problem hiding this comment.
Идея правильная, но реализация неверная: значение сдвига не то. Правый аргумент сдвига - число битов, на которое этот сдвиг совершается. Число snowflake_id состоит из 63 битов, а у вас только NODE_ID_MAX имеет значение 1023. Т.е. вы на очень большое значение вправо все сдвините, получите 0 и прибавите к нему epoch_ms. В итоге функция всегда возвращает значение epoch_ms.
| print(f"sequence_id must be in [0, {SEQUENCE_ID_MAX}], but is {sequence_id}") | ||
| return None | ||
|
|
||
| timestamp = read_current_millis(epoch_ms) |
Member
There was a problem hiding this comment.
Из-за ошибки в read_current_millis тесты на генерацию ID не проходят, т.к. timestamp некорректно считается.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.