mregni / EmbyStat

Multiplatform statistics server for Emby server
MIT License
284 stars 22 forks source link

Insert person throws duplicate exception #1183

Closed mregni closed 2 years ago

mregni commented 4 years ago
2020-04-21 13:17:04.8217 [ERROR] Error fetching data for person Ikue Otani. LiteDB.LiteException: Cannot insert duplicate key in unique index '_id'. The duplicate value is '"56854"'.
   at LiteDB.Engine.IndexService.AddNode(CollectionIndex index, BsonValue key, PageAddress dataBlock, Byte level, IndexNode last)
   at LiteDB.Engine.LiteEngine.InsertDocument(Snapshot snapshot, BsonDocument doc, BsonAutoId autoId, IndexService indexer, DataService data)
   at LiteDB.Engine.LiteEngine.<>c__DisplayClass7_0.<Insert>b__0(TransactionService transaction)
   at LiteDB.Engine.LiteEngine.AutoTransaction[T](Func`2 fn)
   at LiteDB.SharedEngine.Insert(String collection, IEnumerable`1 docs, BsonAutoId autoId)
   at LiteDB.LiteCollection`1.Insert(T entity)
   at EmbyStat.Repositories.PersonRepository.<>c__DisplayClass1_0.<Insert>b__0()
   at EmbyStat.Repositories.BaseRepository.ExecuteQuery(Action query)
   at EmbyStat.Services.PersonService.GetPersonByName(String name)
2020-04-21 13:26:16.5914 [INFO] MEDIASYNC-JOB Calculating show statistics 
2020-04-21 13:28:31.1233 [INFO] MEDIASYNC-JOB Job finished after 29 minutes. 
2020-04-21 14:00:03.6922 [INFO] DATABASE CLEANUP-JOB Starting job 
2020-04-21 14:00:03.8519 [INFO] DATABASE CLEANUP-JOB Removed old statistic results. 
2020-04-21 14:00:03.8958 [INFO] DATABASE CLEANUP-JOB Job finished after 1 minute. 
2020-04-21 14:49:05.4374 [ERROR] Error fetching data for person Ikue Otani. LiteDB.LiteException: Cannot insert duplicate key in unique index '_id'. The duplicate value is '"56854"'.
   at LiteDB.Engine.IndexService.AddNode(CollectionIndex index, BsonValue key, PageAddress dataBlock, Byte level, IndexNode last)
   at LiteDB.Engine.LiteEngine.InsertDocument(Snapshot snapshot, BsonDocument doc, BsonAutoId autoId, IndexService indexer, DataService data)
   at LiteDB.Engine.LiteEngine.<>c__DisplayClass7_0.<Insert>b__0(TransactionService transaction)
   at LiteDB.Engine.LiteEngine.AutoTransaction[T](Func`2 fn)
   at LiteDB.SharedEngine.Insert(String collection, IEnumerable`1 docs, BsonAutoId autoId)
   at LiteDB.LiteCollection`1.Insert(T entity)
   at EmbyStat.Repositories.PersonRepository.<>c__DisplayClass1_0.<Insert>b__0()
   at EmbyStat.Repositories.BaseRepository.ExecuteQuery(Action query)
   at EmbyStat.Services.PersonService.GetPersonByName(String name)

Need to change the Insert to Upsert

mregni commented 2 years ago

Closing because old bug with old database tech.