Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

nano level precision

chrislu57a46f46a046
diff --git a/weed/filer/reader_cache.go b/weed/filer/reader_cache.go
index 89db04eb00..cb89c03c53 100644
--- a/weed/filer/reader_cache.go
+++ b/weed/filer/reader_cache.go
@@ -96,7 +96,7 @@ func (rc *ReaderCache) ReadChunkAt(buffer []byte, fileId string, cipherKey []byt
// clean up old downloaders
if len(rc.downloaders) >= rc.limit {
- oldestFid, oldestTime := "", time.Now().Unix()
+ oldestFid, oldestTime := "", time.Now().UnixNano()
for fid, downloader := range rc.downloaders {
completedTime := atomic.LoadInt64(&downloader.completedTimeNew)
if completedTime > 0 && completedTime < oldestTime {
@@ -179,7 +179,7 @@ func (s *SingleChunkCacher) startCaching() {
if s.shouldCache {
s.parent.chunkCache.SetChunk(s.chunkFileId, s.data)
}
- atomic.StoreInt64(&s.completedTimeNew, time.Now().Unix())
+ atomic.StoreInt64(&s.completedTimeNew, time.Now().UnixNano())
return
}