File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -149,14 +149,17 @@ func (m *Manager) Run(ctx context.Context) error {
149149 waitTime time.Duration
150150 backoff time.Duration
151151 attempts int
152+ timer = time .NewTimer (0 )
152153 )
153154
154155 // Start the notification runloop.
155156 for {
156157 // Increase the wait time for the next iteration.
157158 backoff = waitTime + time .Duration (attempts )* time .Second
158159 waitTime = 0
159- timer := time .NewTimer (backoff )
160+
161+ // Reset the timer with the new backoff time.
162+ timer .Reset (backoff )
160163
161164 // Return if the context has been canceled.
162165 select {
@@ -179,6 +182,10 @@ func (m *Manager) Run(ctx context.Context) error {
179182 log .Errorf ("Error getting L402 from " +
180183 "the store: %v" , err )
181184 }
185+
186+ // Use a default of 1 second wait time to avoid
187+ // hogging the CPU.
188+ waitTime = time .Second
182189 continue
183190 }
184191
You can’t perform that action at this time.
0 commit comments