| 3716 | } |
| 3717 | |
| 3718 | func (i *Ingester) getInstanceLimits() *InstanceLimits { |
| 3719 | // Don't apply any limits while starting. We especially don't want to apply series in memory limit while replaying WAL. |
| 3720 | if i.State() == services.Starting { |
| 3721 | return nil |
| 3722 | } |
| 3723 | |
| 3724 | if i.cfg.InstanceLimitsFn == nil { |
| 3725 | return defaultInstanceLimits |
| 3726 | } |
| 3727 | |
| 3728 | l := i.cfg.InstanceLimitsFn() |
| 3729 | if l == nil { |
| 3730 | return defaultInstanceLimits |
| 3731 | } |
| 3732 | |
| 3733 | return l |
| 3734 | } |
| 3735 | |
| 3736 | // stopIncomingRequests is called during the shutdown process. |
| 3737 | func (i *Ingester) stopIncomingRequests() { |