| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 | 142 |
| 143 bc := bundler.Config{ | 143 bc := bundler.Config{ |
| 144 Clock: clock.Get(ctx), | 144 Clock: clock.Get(ctx), |
| 145 Project: config.Project, | 145 Project: config.Project, |
| 146 Prefix: config.Prefix, | 146 Prefix: config.Prefix, |
| 147 MaxBufferedBytes: streamBufferSize, | 147 MaxBufferedBytes: streamBufferSize, |
| 148 MaxBundleSize: config.Output.MaxSize(), | 148 MaxBundleSize: config.Output.MaxSize(), |
| 149 } | 149 } |
| 150 if config.BufferLogs { | 150 if config.BufferLogs { |
| 151 bc.MaxBufferDelay = config.MaxBufferAge | 151 bc.MaxBufferDelay = config.MaxBufferAge |
| 152 if bc.MaxBufferDelay <= 0 { |
| 153 bc.MaxBufferDelay = DefaultMaxBufferAge |
| 154 } |
| 152 } | 155 } |
| 153 lb := bundler.New(bc) | 156 lb := bundler.New(bc) |
| 154 | 157 |
| 155 b := &Butler{ | 158 b := &Butler{ |
| 156 c: &config, | 159 c: &config, |
| 157 ctx: ctx, | 160 ctx: ctx, |
| 158 | 161 |
| 159 bundler: lb, | 162 bundler: lb, |
| 160 bundlerDrainedC: make(chan struct{}), | 163 bundlerDrainedC: make(chan struct{}), |
| 161 | 164 |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 // shutdown prematurely, so this should be reasonably quick. | 541 // shutdown prematurely, so this should be reasonably quick. |
| 539 b.Activate() | 542 b.Activate() |
| 540 } | 543 } |
| 541 | 544 |
| 542 // Returns the configured Butler error. | 545 // Returns the configured Butler error. |
| 543 func (b *Butler) getRunErr() error { | 546 func (b *Butler) getRunErr() error { |
| 544 b.shutdownMu.Lock() | 547 b.shutdownMu.Lock() |
| 545 defer b.shutdownMu.Unlock() | 548 defer b.shutdownMu.Unlock() |
| 546 return b.runErr | 549 return b.runErr |
| 547 } | 550 } |
| OLD | NEW |