Shorten window for cleanup

This commit is contained in:
Jonathan Staab 2023-01-05 04:42:20 -08:00
parent 4c7decd7e3
commit 74eebf8d79
2 changed files with 13 additions and 6 deletions

View File

@ -20,13 +20,18 @@ If you like Coracle and want to support its development, you can donate sats via
- [ ] Persist and load relay list
- [ ] Add followers/follows lists on profile page
- [ ] Image uploads
- [ ] Server discovery and relay publishing - https://github.com/nostr-protocol/nips/pull/32/files
- [ ] Server discovery and relay publishing https://github.com/nostr-protocol/nips/pull/32/files
- [ ] Support invoices https://twitter.com/jb55/status/1604131336247476224
- [ ] NIP 05
- [ ] Lightning tips
- [ ] Direct messages
- [ ] Direct messages https://github.com/nbd-wtf/nostr-tools/blob/master/nip04.ts
- [ ] Rooms/groups
- [ ] Custom feeds
- [ ] Render and auto-link bech32 entities
- https://github.com/nostr-protocol/nips/blob/master/19.md
- https://github.com/nbd-wtf/nostr-tools/blob/master/nip19.ts
- [ ] Support key delegation
- https://github.com/nbd-wtf/nostr-tools/blob/master/nip26.ts
# Bugs

View File

@ -104,10 +104,12 @@ db.events.process = async events => {
})
}
// On initial load, delete old event data
setTimeout(() => {
const threshold = now() - timedelta(1, 'days')
// Periodicallly delete old event data
(function cleanup() {
const threshold = now() - timedelta(1, 'hours')
db.events.where('loaded_at').below(threshold).delete()
db.tags.where('loaded_at').below(threshold).delete()
}, timedelta(10, 'seconds'))
setTimeout(cleanup, timedelta(15, 'minutes'))
})()