File tree 1 file changed +8
-1
lines changed 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 {
149
149
waitTime time.Duration
150
150
backoff time.Duration
151
151
attempts int
152
+ timer = time .NewTimer (0 )
152
153
)
153
154
154
155
// Start the notification runloop.
155
156
for {
156
157
// Increase the wait time for the next iteration.
157
158
backoff = waitTime + time .Duration (attempts )* time .Second
158
159
waitTime = 0
159
- timer := time .NewTimer (backoff )
160
+
161
+ // Reset the timer with the new backoff time.
162
+ timer .Reset (backoff )
160
163
161
164
// Return if the context has been canceled.
162
165
select {
@@ -179,6 +182,10 @@ func (m *Manager) Run(ctx context.Context) error {
179
182
log .Errorf ("Error getting L402 from " +
180
183
"the store: %v" , err )
181
184
}
185
+
186
+ // Use a default of 1 second wait time to avoid
187
+ // hogging the CPU.
188
+ waitTime = time .Second
182
189
continue
183
190
}
184
191
You can’t perform that action at this time.
0 commit comments