mirror of
https://github.com/aljazceru/haven.git
synced 2025-12-18 14:24:18 +01:00
revert all this was a horrible idea
This commit is contained in:
11
import.go
11
import.go
@@ -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)
|
||||
@@ -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) {
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user