mirror of
https://github.com/aljazceru/haven.git
synced 2025-12-18 22:24:22 +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++
|
ownerImportedNotes++
|
||||||
}
|
}
|
||||||
log.Println("📦 imported", ownerImportedNotes, "owner notes")
|
log.Println("📦 imported", ownerImportedNotes, "owner notes")
|
||||||
|
time.Sleep(5 * time.Second)
|
||||||
|
|
||||||
startTime = startTime.Add(240 * time.Hour)
|
startTime = startTime.Add(240 * time.Hour)
|
||||||
endTime = endTime.Add(240 * time.Hour)
|
endTime = endTime.Add(240 * time.Hour)
|
||||||
@@ -66,15 +67,21 @@ func importTaggedNotes() {
|
|||||||
fmt.Println("Error parsing start date:", err)
|
fmt.Println("Error parsing start date:", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
endTime := startTime.Add(240 * time.Hour)
|
||||||
|
|
||||||
for {
|
for {
|
||||||
ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
|
ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
|
startTimestamp := nostr.Timestamp(startTime.Unix())
|
||||||
|
endTimestamp := nostr.Timestamp(endTime.Unix())
|
||||||
|
|
||||||
filters := []nostr.Filter{{
|
filters := []nostr.Filter{{
|
||||||
Tags: nostr.TagMap{
|
Tags: nostr.TagMap{
|
||||||
"p": {nPubToPubkey(config.OwnerNpub)},
|
"p": {nPubToPubkey(config.OwnerNpub)},
|
||||||
},
|
},
|
||||||
|
Since: &startTimestamp,
|
||||||
|
Until: &endTimestamp,
|
||||||
}}
|
}}
|
||||||
|
|
||||||
for ev := range pool.SubManyEose(ctx, config.ImportSeedRelays, filters) {
|
for ev := range pool.SubManyEose(ctx, config.ImportSeedRelays, filters) {
|
||||||
@@ -92,6 +99,10 @@ func importTaggedNotes() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.Println("📦 imported", taggedImportedNotes, "tagged notes")
|
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()) {
|
if startTime.After(time.Now()) {
|
||||||
log.Println("✅ tagged import complete. please restart the relay")
|
log.Println("✅ tagged import complete. please restart the relay")
|
||||||
|
|||||||
Reference in New Issue
Block a user