(ctx context.Context, cancelParent context.CancelFunc, d *drawer, a attacker.Attacker)
| 46 | } |
| 47 | |
| 48 | func attack(ctx context.Context, cancelParent context.CancelFunc, d *drawer, a attacker.Attacker) { |
| 49 | if d.chartDrawing.Load() { |
| 50 | return |
| 51 | } |
| 52 | child, cancelChild := context.WithCancel(ctx) |
| 53 | |
| 54 | // To initialize, run redrawChart on a per-attack basis. |
| 55 | go d.redrawCharts(child) |
| 56 | go d.redrawGauge(child, a.Duration()) |
| 57 | go func() { |
| 58 | if err := a.Attack(child, d.metricsCh); err != nil { |
| 59 | d.setExportErr(err) |
| 60 | cancelChild() |
| 61 | cancelParent() |
| 62 | return |
| 63 | } |
| 64 | cancelChild() |
| 65 | }() |
| 66 | } |