| OLD | NEW |
| 1 // Copyright 2015 The LUCI Authors. All rights reserved. | 1 // Copyright 2015 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 butler | 5 package butler |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "errors" | 8 "errors" |
| 9 "fmt" | 9 "fmt" |
| 10 "io" | 10 "io" |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 p = p.Clone() | 399 p = p.Clone() |
| 400 if p.Timestamp == nil || p.Timestamp.Time().IsZero() { | 400 if p.Timestamp == nil || p.Timestamp.Time().IsZero() { |
| 401 p.Timestamp = google.NewTimestamp(clock.Now(b.ctx)) | 401 p.Timestamp = google.NewTimestamp(clock.Now(b.ctx)) |
| 402 } | 402 } |
| 403 if err := p.Validate(); err != nil { | 403 if err := p.Validate(); err != nil { |
| 404 return err | 404 return err |
| 405 } | 405 } |
| 406 | 406 |
| 407 // Build per-stream tag map. | 407 // Build per-stream tag map. |
| 408 if l := len(b.c.GlobalTags); l > 0 { | 408 if l := len(b.c.GlobalTags); l > 0 { |
| 409 if p.Tags == nil { |
| 410 p.Tags = make(map[string]string, l) |
| 411 } |
| 412 |
| 409 for k, v := range b.c.GlobalTags { | 413 for k, v := range b.c.GlobalTags { |
| 410 // Add only global flags that aren't already present (ov
erridden) in | 414 // Add only global flags that aren't already present (ov
erridden) in |
| 411 // stream tags. | 415 // stream tags. |
| 412 if _, ok := p.Tags[k]; !ok { | 416 if _, ok := p.Tags[k]; !ok { |
| 413 p.Tags[k] = v | 417 p.Tags[k] = v |
| 414 } | 418 } |
| 415 } | 419 } |
| 416 } | 420 } |
| 417 | 421 |
| 418 if p.Timeout > 0 { | 422 if p.Timeout > 0 { |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 // shutdown prematurely, so this should be reasonably quick. | 662 // shutdown prematurely, so this should be reasonably quick. |
| 659 b.Activate() | 663 b.Activate() |
| 660 } | 664 } |
| 661 | 665 |
| 662 // Returns the configured Butler error. | 666 // Returns the configured Butler error. |
| 663 func (b *Butler) getRunErr() error { | 667 func (b *Butler) getRunErr() error { |
| 664 b.shutdownMu.Lock() | 668 b.shutdownMu.Lock() |
| 665 defer b.shutdownMu.Unlock() | 669 defer b.shutdownMu.Unlock() |
| 666 return b.runErr | 670 return b.runErr |
| 667 } | 671 } |
| OLD | NEW |