mirror of
https://github.com/otaviocc/Triton.git
synced 2026-01-30 04:04:27 +00:00
Deleted stale tags before fetching new blog posts
This commit is contained in:
parent
c1aaf3af68
commit
eedd369c37
1 changed files with 6 additions and 0 deletions
|
|
@ -121,6 +121,7 @@ actor WeblogPersistenceService: WeblogPersistenceServiceProtocol {
|
||||||
private func storeEntries(
|
private func storeEntries(
|
||||||
_ entries: [StorableEntry]
|
_ entries: [StorableEntry]
|
||||||
) throws {
|
) throws {
|
||||||
|
try removeAllTags()
|
||||||
try entries.forEach(storeEntry)
|
try entries.forEach(storeEntry)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -149,6 +150,11 @@ actor WeblogPersistenceService: WeblogPersistenceServiceProtocol {
|
||||||
container.mainContext.insert(newTag)
|
container.mainContext.insert(newTag)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@MainActor
|
||||||
|
private func removeAllTags() throws {
|
||||||
|
try container.mainContext.delete(model: WeblogTag.self)
|
||||||
|
}
|
||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
private func removeDeletedEntries(
|
private func removeDeletedEntries(
|
||||||
_ entries: [StorableEntry]
|
_ entries: [StorableEntry]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue