Skip to content

chore(core): use Tick() instead of NewTicker()#9548

Merged
matthewmcneely merged 1 commit intodgraph-io:mainfrom
xqqp:tick
Jan 2, 2026
Merged

chore(core): use Tick() instead of NewTicker()#9548
matthewmcneely merged 1 commit intodgraph-io:mainfrom
xqqp:tick

Conversation

@xqqp
Copy link
Contributor

@xqqp xqqp commented Dec 31, 2025

Description

  • Replaces all uses of time.NewTicker() with time.Tick(). Since Go 1.23 the garbage collector can automatically clean up unreferenced tickers. Therefore, we can just use Tick() instead of NewTicker() and remove all defer ticker.Stop().
  • Removes all calls to stop a timer. Similar to tickers, since Go 1.23 timers can also be garbage collected automatically without calling timer.Stop().
  • Remove two ticker member variables that were only used in a single function.
  • Changes the function PollTillPassOrTimeout() to use the timeout argument

@xqqp xqqp requested a review from a team as a code owner December 31, 2025 00:25
Copy link
Contributor

@matthewmcneely matthewmcneely left a comment

Choose a reason for hiding this comment

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

Thanks for the improvements!

@matthewmcneely matthewmcneely merged commit 6929c8e into dgraph-io:main Jan 2, 2026
24 of 25 checks passed
@xqqp xqqp deleted the tick branch January 2, 2026 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants