Skip to content

Commit

Permalink
revert all this was a horrible idea
Browse files Browse the repository at this point in the history
  • Loading branch information
barrydeen committed Sep 24, 2024
1 parent f006fbe commit b53bb28
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions import.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ 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)
Expand All @@ -66,15 +67,21 @@ func importTaggedNotes() {
fmt.Println("Error parsing start date:", err)
return
}
endTime := startTime.Add(240 * time.Hour)

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

startTimestamp := nostr.Timestamp(startTime.Unix())
endTimestamp := nostr.Timestamp(endTime.Unix())

filters := []nostr.Filter{{
Tags: nostr.TagMap{
"p": {nPubToPubkey(config.OwnerNpub)},
},
Since: &startTimestamp,
Until: &endTimestamp,
}}

for ev := range pool.SubManyEose(ctx, config.ImportSeedRelays, filters) {
Expand All @@ -92,6 +99,10 @@ func importTaggedNotes() {
}
}
log.Println("📦 imported", taggedImportedNotes, "tagged notes")
time.Sleep(5 * time.Second)

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

if startTime.After(time.Now()) {
log.Println("✅ tagged import complete. please restart the relay")
Expand Down

0 comments on commit b53bb28

Please sign in to comment.