Fixed storing last import timestamp

This commit is contained in:
Philipp Wolfer 2023-11-21 18:14:11 +01:00
parent fa7732c538
commit 1af484e0f6
No known key found for this signature in database
GPG key ID: 8FDF744D4919943B
3 changed files with 34 additions and 16 deletions

View file

@ -102,6 +102,9 @@ var listensCmd = &cobra.Command{
result.ImportCount, result.TotalCount, targetName)
// Update timestamp
if result.LastTimestamp.Unix() < timestamp.Unix() {
result.LastTimestamp = timestamp
}
fmt.Printf("Latest timestamp: %v (%v)\n", result.LastTimestamp, result.LastTimestamp.Unix())
err = db.SetImportTimestamp(sourceName, targetName, "listens", result.LastTimestamp)
cobra.CheckErr(err)

View file

@ -102,6 +102,9 @@ var lovesCmd = &cobra.Command{
result.ImportCount, result.TotalCount, targetName)
// Update timestamp
if result.LastTimestamp.Unix() < timestamp.Unix() {
result.LastTimestamp = timestamp
}
fmt.Printf("Latest timestamp: %v (%v)\n", result.LastTimestamp, result.LastTimestamp.Unix())
err = db.SetImportTimestamp(sourceName, targetName, "loves", result.LastTimestamp)
cobra.CheckErr(err)