refresh will check if the object info is expired and request the info from source if it is all these conditions must be true to ignore a refresh 1. cache ts didn't expire yet 2. is not pending a notification from the wrapped fs
(ctx context.Context)
| 156 | // 1. cache ts didn't expire yet |
| 157 | // 2. is not pending a notification from the wrapped fs |
| 158 | func (o *Object) refresh(ctx context.Context) error { |
| 159 | isNotified := o.CacheFs.isNotifiedRemote(o.Remote()) |
| 160 | isExpired := time.Now().After(o.CacheTs.Add(time.Duration(o.CacheFs.opt.InfoAge))) |
| 161 | if !isExpired && !isNotified { |
| 162 | return nil |
| 163 | } |
| 164 | |
| 165 | return o.refreshFromSource(ctx, true) |
| 166 | } |
| 167 | |
| 168 | // refreshFromSource requests the original FS for the object in case it comes from a cached entry |
| 169 | func (o *Object) refreshFromSource(ctx context.Context, force bool) error { |
no test coverage detected