Skip to content

Commit

Permalink
better test ext
Browse files Browse the repository at this point in the history
  • Loading branch information
andyborn committed Aug 3, 2023
1 parent 79e0ece commit 73dddd7
Showing 1 changed file with 2 additions and 27 deletions.
29 changes: 2 additions & 27 deletions incremental_ext_test.go
Original file line number Diff line number Diff line change
@@ -1,38 +1,13 @@
package feedx

import (
"errors"
"time"

"github.com/bsm/bfs"
)

func (p *IncrementalProducer) LoadManifest() (*Manifest, error) {
remote := bfs.NewObjectFromBucket(p.bucket, "manifest.json")
defer remote.Close()

m := new(Manifest)

r, err := NewReader(p.ctx, remote, nil)
if errors.Is(err, bfs.ErrNotFound) {
return m, nil
} else if err != nil {
return nil, err
}
defer r.Close()

if err := r.Decode(m); errors.Is(err, bfs.ErrNotFound) { // some BFS implementations defer Open-ing the S3 object till first Decode call
return m, nil
} else if err != nil {
return nil, err
}

return m, nil
return p.loadManifest()
}

func TimestampFromTime(t time.Time) timestamp {
if n := t.Unix()*1000 + int64(t.Nanosecond()/1e6); n > 0 {
return timestamp(n)
}
return 0
return timestampFromTime(t)
}

0 comments on commit 73dddd7

Please sign in to comment.