这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@ndyakov
Copy link
Member

@ndyakov ndyakov commented May 30, 2025

  • it is safer to set the receivedAt when creating the token
  • make sure the manager main loop won't panic

ndyakov added 3 commits May 30, 2025 19:32
- Updated IsClosed function to accurately check if a channel is closed without consuming data unless necessary.
- Safely close the closedChan only if it is not already closed to avoid potential panics.
- Implemented panic recovery in the Start method of entraidTokenManager to prevent crashes and ensure listener is notified of errors.
- Updated the New function to return nil if expiresOn is zero to prevent panic.
- Added logic to set receivedAt to the current time and recalculate TTL if receivedAt is zero.
- Improved documentation to clarify the responsibilities of the caller regarding token validity and behavior when parameters are zero.
@github-actions
Copy link

github-actions bot commented Jun 2, 2025

Merging this branch will decrease overall coverage

Impacted Packages Coverage Δ 🤖
github.com/redis/go-redis-entraid/internal 100.00% (ø)
github.com/redis/go-redis-entraid/manager 96.28% (-2.07%) 👎
github.com/redis/go-redis-entraid/token 100.00% (ø)

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/redis/go-redis-entraid/internal/utils.go 100.00% (ø) 3 3 0
github.com/redis/go-redis-entraid/manager/entraid_manager.go 93.75% (-3.39%) 112 (+7) 105 (+3) 7 (+4) 👎
github.com/redis/go-redis-entraid/token/token.go 100.00% (ø) 16 (+2) 16 (+2) 0

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files

  • github.com/redis/go-redis-entraid/manager/entraid_manager_test.go
  • github.com/redis/go-redis-entraid/token/token_test.go

@ndyakov ndyakov merged commit f387795 into main Aug 6, 2025
7 checks passed
@ndyakov ndyakov deleted the ndyakov/small-refactors branch August 6, 2025 07:26
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.

3 participants