Hambergo / 9kmmrbot

MIT License
104 stars 29 forks source link

!np just don't give anything #28

Closed Banonevar closed 5 years ago

Banonevar commented 5 years ago

I'v use !np command, and it's return nothing. No rejections like Game wasn't found. Just nothing. No errors console, no chat. Account added to chanel, account in dota match, but bot gives nothing. Why it can happens?

Banonevar commented 5 years ago

!lg, !gm not working too. Only !score, !medal working correctly

Hambergo commented 5 years ago

Sounds like it's a problem with findGameFromChannel, but I haven't encountered it. Is it the same for any account? Are the collections games and rps getting filled?

Hambergo commented 5 years ago

Looks like I removed printing of errors somewhere, try changing

if (err instanceof CustomError) {
    return err.message
}

lines 49-51 on index.js to

if (err instanceof CustomError) {
    return err.message
}
else {
    console.log(err)
}

and tell what it prints

Banonevar commented 5 years ago

Same for all channels and accounts Yea, games and rps is filling, will try add that log to index.js

Banonevar commented 5 years ago
19|AIBT  | MongoError: Exceeded memory limit for $group, but didn't allow external sort. Pass allowDiskUse:true to opt in.
19|AIBT  |     at Connection.<anonymous> (/root/scripts/aibt/node_modules/mongodb-core/lib/connection/pool.js:443:61)
19|AIBT  |     at Connection.emit (events.js:196:13)
19|AIBT  |     at processMessage (/root/scripts/aibt/node_modules/mongodb-core/lib/connection/connection.js:364:10)
19|AIBT  |     at TLSSocket.<anonymous> (/root/scripts/aibt/node_modules/mongodb-core/lib/connection/connection.js:533:15)
19|AIBT  |     at TLSSocket.emit (events.js:196:13)
19|AIBT  |     at addChunk (_stream_readable.js:290:12)
19|AIBT  |     at readableAddChunk (_stream_readable.js:271:11)
19|AIBT  |     at TLSSocket.Readable.push (_stream_readable.js:226:10)
19|AIBT  |     at TLSWrap.onStreamRead (internal/stream_base_commons.js:166:17) {
19|AIBT  |   operationTime: Timestamp { _bsontype: 'Timestamp', low_: 10, high_: 1558630929 },
19|AIBT  |   ok: 0,
19|AIBT  |   errmsg: "Exceeded memory limit for $group, but didn't allow " +
19|AIBT  |     'external sort. Pass allowDiskUse:true to opt in.',
19|AIBT  |   code: 16945,
19|AIBT  |   codeName: 'Location16945',
19|AIBT  |   '$clusterTime': {
19|AIBT  |     clusterTime: Timestamp { _bsontype: 'Timestamp', low_: 10, high_: 1558630929 },
19|AIBT  |     signature: { hash: [Binary], keyId: [Long] }
19|AIBT  |   },
19|AIBT  |   name: 'MongoError',
19|AIBT  |   [Symbol(mongoErrorContextSymbol)]: {}
19|AIBT  | }

I added allowDiskUse:true, seems like no error like that, more, need to test commands. Btw is is safe? Is it will use much RAM or something?

Hambergo commented 5 years ago

Yeah, try passing allowDiskUse:true like it says

you can add an index createdAt with expireAfterSeconds: 1800 to the collections games and rps I have an index createdAt with expireAfterSeconds: 21600 in collection last games and dac

they're mostly to save space, but i guess on collections games and rps it's more important

Banonevar commented 5 years ago

Thx!

Banonevar commented 5 years ago

What is dac?

Hambergo commented 5 years ago

A collection of info about games from steam webapi It's currently used for storing info about games that an account is watching (normal spectating with delay, not as a caster/camera person/live spectating with dota plus)

Banonevar commented 5 years ago

Can i have latest question? What model of object must be for notable players collection? I just want import all Pro Players from opendota, and wan't know structure of your DB Can you provide just 1 example of object for that collection?

Hambergo commented 5 years ago
{
id:'id',
channel:'channel id for local or empty string for global',
name:'name',
enabled:true
}

id is the account id of the player, i think it has to be in a string because of how it was written in the code

channel is the id of the twitch channel the player will be shown, empty string for global, again string for the same reason

for example

{
id:'1',
channel:'',
name:'test',
enabled:true
}

to have the account id 1 show as test globally

Banonevar commented 5 years ago

Oh, it's enought info! I'm very appreciated

Banonevar commented 5 years ago

Hey again, seems like allowDiskUse:true no more working, and mongo keep spam that error again. Also i added indexes, but it's not helped too

db.games.getIndexes()
[
        {
                "v" : 2,
                "key" : {
                        "_id" : 1
                },
                "name" : "_id_",
                "ns" : "mmrbot.games"
        },
        {
                "v" : 2,
                "key" : {
                        "createdAt" : 1
                },
                "name" : "createdAt_1",
                "ns" : "mmrbot.games",
                "expireAfterSeconds" : 21600
        }
]
Hambergo commented 5 years ago

try having the expireAfterSeconds on 1800 both on games and rps collection I opened a new issue (#30) about this problem, i'll make the change later today or tomorrow

Hambergo commented 5 years ago

Commit 6535874616d974fc736fe425c0e3b252ba0d762e fixes this problem by taking only the documents from the past 15 minutes into the aggregations

Banonevar commented 5 years ago

@Hambergo does that mean bot will know games only for 15 minutes? I mean if game was started 30 mins ago and it's still playing, bot will not know about this game?

Banonevar commented 5 years ago

Well, i updated to latest master, and got Game wasn't found on !np command, but game in progress on 5700 avg mmr

Hambergo commented 5 years ago

The bot will know about it, the bot requests to know which game everyone is currently playing every 30s, it'll only take games everyone reported currently playing from the last 15 minutes (the bot allows for up to 10 minutes of delaying the result for np so further than that is not needed. The delay is mostly used to have with having stream delay on or spectating games to not get spoilers)

I'm not sure why it happened, but if you added a new ID it can take 30s to start showing

Banonevar commented 5 years ago

I'm droped all indexes, and it seems working now! Great job!

Banonevar commented 5 years ago

Hm, or not. BOt was know about game only first 10 minutes of game, when 10 minutes pass, he start sayin game wasn't found

Hambergo commented 5 years ago

Wow that sounds weird, does the same happen if you try to add the same account to 9kmmrbot on a channel?

Or is it possible that the user went offline on steam? Because if the game isn't showing in the top 100 games on watch tab it can stop showing

Banonevar commented 5 years ago

Yes, same. No, user online image

Hambergo commented 5 years ago

Can you try again? It looks like you didn't wait 30s between adding and trying, and I added on my channel and it worked

Banonevar commented 5 years ago

Well, now it's ok from 9kmmrbot, but not from mine image

Hambergo commented 5 years ago

Can you tell what is returned from db.games.find({players.account_id:405655217}) and db.rps.find({account_id:405655217})

Banonevar commented 5 years ago

It's returned much objects, how i can filter them?

Hambergo commented 5 years ago

Sort by createdAt and return the few newest results and results from when it worked, if possible