Skip to content

Commit

Permalink
speed up import
Browse files Browse the repository at this point in the history
  • Loading branch information
barrydeen committed Sep 24, 2024
1 parent 7776f96 commit 1466539
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions import.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ func importOwnerNotes() {
fmt.Println("Error parsing start date:", err)
return
}
endTime := startTime.Add(240 * time.Hour)
endTime := startTime.Add(500 * time.Hour)

for {
ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
ctx, cancel := context.WithTimeout(ctx, 3*time.Second)
defer cancel()

startTimestamp := nostr.Timestamp(startTime.Unix())
Expand All @@ -46,10 +46,9 @@ func importOwnerNotes() {
ownerImportedNotes++
}
log.Println("📦 imported", ownerImportedNotes, "owner notes")
time.Sleep(5 * time.Second)

startTime = startTime.Add(240 * time.Hour)
endTime = endTime.Add(240 * time.Hour)
startTime = startTime.Add(500 * time.Hour)
endTime = endTime.Add(500 * time.Hour)

if startTime.After(time.Now()) {
log.Println("✅ owner note import complete! ")
Expand Down

0 comments on commit 1466539

Please sign in to comment.