| 246 | } |
| 247 | |
| 248 | func (b *BackgroundManager) GetStatus(ctx context.Context) ([]byte, error) { |
| 249 | if b.isClusterAware() { |
| 250 | status, err := b.getStatusFromCluster(ctx) |
| 251 | if err != nil { |
| 252 | return nil, err |
| 253 | } |
| 254 | |
| 255 | // If we're running cluster mode, but we have no status it means we haven't run it yet. |
| 256 | // Get local status which will construct a 'initial' status |
| 257 | if status == nil { |
| 258 | status, _, err = b.getStatusLocal() |
| 259 | return status, err |
| 260 | } |
| 261 | |
| 262 | return status, err |
| 263 | } |
| 264 | |
| 265 | status, _, err := b.getStatusLocal() |
| 266 | return status, err |
| 267 | } |
| 268 | |
| 269 | func (b *BackgroundManager) getStatusLocal() ([]byte, []byte, error) { |
| 270 | b.lock.Lock() |