(ctx context.Context)
| 1120 | } |
| 1121 | |
| 1122 | func (c *clusterStateHolder) Get(ctx context.Context) (*clusterState, error) { |
| 1123 | v := c.state.Load() |
| 1124 | if v == nil { |
| 1125 | return c.Reload(ctx) |
| 1126 | } |
| 1127 | |
| 1128 | state := v.(*clusterState) |
| 1129 | if time.Since(state.createdAt) > c.reloadInterval { |
| 1130 | c.LazyReload() |
| 1131 | } |
| 1132 | return state, nil |
| 1133 | } |
| 1134 | |
| 1135 | func (c *clusterStateHolder) ReloadOrGet(ctx context.Context) (*clusterState, error) { |
| 1136 | state, err := c.Reload(ctx) |
no test coverage detected