OLD | NEW |
1 // Copyright 2016 The LUCI Authors. All rights reserved. | 1 // Copyright 2016 The LUCI Authors. All rights reserved. |
2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
4 | 4 |
5 package main | 5 package main |
6 | 6 |
7 import ( | 7 import ( |
8 "bytes" | 8 "bytes" |
9 "fmt" | 9 "fmt" |
10 "os" | 10 "os" |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 } | 227 } |
228 client.Options.Insecure = lhttp.IsLocalHost(r.host) | 228 client.Options.Insecure = lhttp.IsLocalHost(r.host) |
229 dc := dm.NewDepsPRPCClient(client) | 229 dc := dm.NewDepsPRPCClient(client) |
230 | 230 |
231 prev := "" | 231 prev := "" |
232 seq := 0 | 232 seq := 0 |
233 | 233 |
234 for c.Err() == nil { | 234 for c.Err() == nil { |
235 gdata, err := runQuery(c, dc, query) | 235 gdata, err := runQuery(c, dc, query) |
236 if err != nil { | 236 if err != nil { |
237 » » » if errors.Contains(err, context.Canceled) { | 237 » » » if errors.Any(err, func(err error) bool { return err ==
context.Canceled }) { |
238 return 0 | 238 return 0 |
239 } | 239 } |
240 logging.WithError(err).Errorf(c, "error running query") | 240 logging.WithError(err).Errorf(c, "error running query") |
241 return 1 | 241 return 1 |
242 } | 242 } |
243 | 243 |
244 if gdata != nil { | 244 if gdata != nil { |
245 newVal := renderDotFile(gdata) | 245 newVal := renderDotFile(gdata) |
246 if prev != newVal { | 246 if prev != newVal { |
247 prev = newVal | 247 prev = newVal |
(...skipping 28 matching lines...) Expand all Loading... |
276 return 0 | 276 return 0 |
277 } | 277 } |
278 } | 278 } |
279 } | 279 } |
280 } | 280 } |
281 | 281 |
282 clock.Sleep(c, time.Second/4) | 282 clock.Sleep(c, time.Second/4) |
283 } | 283 } |
284 return 0 | 284 return 0 |
285 } | 285 } |
OLD | NEW |