mirror of
https://github.com/nyanotech/object-holder.git
synced 2025-12-16 03:20:25 -08:00
ignore errors getting current object retention, since this 404s if it doesn't have one
This commit is contained in:
parent
301f1c8ed6
commit
19c5d485ae
7
main.go
7
main.go
@ -71,15 +71,12 @@ func main() {
|
||||
}
|
||||
|
||||
func checkAndRenewObjectLock(svc *s3.Client, object string) {
|
||||
retention, err := svc.GetObjectRetention(context.TODO(), &s3.GetObjectRetentionInput{
|
||||
retention, _ := svc.GetObjectRetention(context.TODO(), &s3.GetObjectRetentionInput{
|
||||
Bucket: bucket,
|
||||
Key: &object,
|
||||
})
|
||||
if err != nil {
|
||||
log.Fatalln("Failed to get retention for", object, err)
|
||||
}
|
||||
|
||||
if retention.Retention.RetainUntilDate.Before(time.Now().Add(time.Second * time.Duration(*updateExpiresWithin))) {
|
||||
if retention == nil || retention.Retention.RetainUntilDate.Before(time.Now().Add(time.Second * time.Duration(*updateExpiresWithin))) {
|
||||
log.Println("Renewing object lock for object", object)
|
||||
_, err := svc.PutObjectRetention(context.TODO(), &s3.PutObjectRetentionInput{
|
||||
Bucket: bucket,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user