sogebot / sogeBot

sogeBot - Free Twitch Bot built on Node.js
https://sogebot.xyz/
GNU General Public License v3.0
289 stars 65 forks source link

!subs bug #727

Closed ghost closed 6 years ago

ghost commented 6 years ago

Expected behavior

Actual behavior

User: !subs bot: Subs: 5, Online: 0. Last sub: tiredinternetchild () Where in () must be $lastSubAgo And on others bots i got n/a instead username

Steps to reproduce

Additional informations

2018-02-06T22:44:27.492219+00:00 app[web.1]: 2018-02-06T22:44:27.491 <<< !_debug 2018-02-06T22:44:27.826278+00:00 app[web.1]: 2018-02-06T22:44:27.826 >>> ======= COPY DEBUG MESSAGE FROM HERE ======= 2018-02-06T22:44:27.835553+00:00 app[web.1]: 2018-02-06T22:44:27.835 >>> GENERAL | OS: npm/5.6.0 node/v9.5.0 linux x64 | DB: mongodb | Bot version: 6.0.0-SNAPSHOT | Bot uptime: 8210.029 | Bot lang: ru | Bot mute: false 2018-02-06T22:44:27.849784+00:00 app[web.1]: 2018-02-06T22:44:27.849 >>> SYSTEMS | timers, customcommands, keywords, points, price, songs, alias, moderation, ranks, raffles, cooldown, gambling, donationalert 2018-02-06T22:44:27.859122+00:00 app[web.1]: 2018-02-06T22:44:27.859 >>> WIDGETS | chat, eventlist, joinpart 2018-02-06T22:44:27.861875+00:00 app[web.1]: 2018-02-06T22:44:27.861 >>> API | HELIX 151/0 | KRAKEN 457/0 | TMI 152/0 2018-02-06T22:44:27.866515+00:00 app[web.1]: 2018-02-06T22:44:27.866 >>> WEBHOOKS | follows, streams 2018-02-06T22:44:27.868541+00:00 app[web.1]: 2018-02-06T22:44:27.868 >>> OAUTH | BOT true | BROADCASTER true 2018-02-06T22:44:27.872390+00:00 app[web.1]: 2018-02-06T22:44:27.872 >>> ======= END OF DEBUG MESSAGE =======

sogehige commented 6 years ago

Please provide your cache.* collections

ghost commented 6 years ago

https://satont.ru/s/f/cache.txt https://satont.ru/s/f/cache.users.txt https://satont.ru/s/f/cache.when.txt

sogehige commented 6 years ago

Hmm your cache.when is broken, will check what is going on mongodb

ghost commented 6 years ago

I can provide cache.when with n/auser

ghost commented 6 years ago

https://satont.ru/s/f/nawhen.txt

ghost commented 6 years ago

It's from other bot when instead username i got n/a

sogehige commented 6 years ago

same issue

sogehige commented 6 years ago

also do you have cache.users collection with n/a user?

ghost commented 6 years ago

https://satont.ru/s/f/newcache.users.txt

sogehige commented 6 years ago

Yeah, duplicated data, ok will fix

sogehige commented 6 years ago

This will be harder issue to fix, its async stuff when several async connections trying to update one item then it is duplicating...need to figure out how to handle this thread safe

sogehige commented 6 years ago

I should add lock system to mongodb (and nedb to be safe) engine. When collection (or _id) is locked, updates will need to wait until current running update is unlocked

sogehige commented 6 years ago

Should be fixed, please remove all affected cache.* collections