(_ error)
| 205 | } |
| 206 | |
| 207 | func (l *PartitionInstanceLifecycler) stopping(_ error) error { |
| 208 | level.Info(l.logger).Log("msg", "partition ring lifecycler is shutting down", "ring", l.ringName) |
| 209 | |
| 210 | // Remove the instance from partition owners, if configured to do so. |
| 211 | if l.RemoveOwnerOnShutdown() { |
| 212 | err := l.updateRing(context.Background(), func(ring *PartitionRingDesc) (bool, error) { |
| 213 | return ring.RemoveOwner(l.partitionOwnerID()), nil |
| 214 | }) |
| 215 | |
| 216 | if err != nil { |
| 217 | level.Error(l.logger).Log("msg", "failed to remove instance from partition owners on shutdown", "instance", l.cfg.InstanceID, "partition_owner_id", l.partitionOwnerID(), "partition", l.cfg.PartitionID, "err", err) |
| 218 | } else { |
| 219 | level.Info(l.logger).Log("msg", "instance removed from partition owners", "instance", l.cfg.InstanceID, "partition_owner_id", l.partitionOwnerID(), "partition", l.cfg.PartitionID) |
| 220 | } |
| 221 | } |
| 222 | |
| 223 | return nil |
| 224 | } |
| 225 | |
| 226 | // runOnLifecyclerLoop runs fn within the lifecycler loop. |
| 227 | func (l *PartitionInstanceLifecycler) runOnLifecyclerLoop(fn func() error) error { |
nothing calls this directly
no test coverage detected