Coder Social home page Coder Social logo

Comments (8)

Katrix avatar Katrix commented on July 26, 2024

Does code like this work fine for you?

from ackcord.

jonathan-ostrander avatar jonathan-ostrander commented on July 26, 2024

It looks like singleFuture goes through the same code path, but let me try to refactor my code to use that pattern instead.

from ackcord.

Katrix avatar Katrix commented on July 26, 2024

Can't reproduce with a for loop, singleFuture and withSideEffects either.

Would be great if you could post the code that's causing this

from ackcord.

jonathan-ostrander avatar jonathan-ostrander commented on July 26, 2024

Sorry it's a bit dense, but it happens in this logic with creating reactions: https://github.com/jonathan-ostrander/music-quiz/blob/master/src/main/scala/dev/ostrander/musicquiz/actor/Game.scala#L148-L151

from ackcord.

jonathan-ostrander avatar jonathan-ostrander commented on July 26, 2024

I can confirm that rate limiting works when just sending messages, but I see the same behavior with this simplified example when sending both reactions and messages through singleIgnore.

from ackcord.

Katrix avatar Katrix commented on July 26, 2024

Hmm, can you confirm that it's actually the fact that the rate limit is never released?

For the above example, it's very likely that it will fail for some of the messages if AckCord has no ratelimit info at all. This is usually the case just after the bot has started. What happens if you try the ratelimit command a second time? Does it work then?

If it does, and you need to send requests in rapid succession like this at the start of the bot's lifespan, take a look at Requests.RequestProperties.retry

from ackcord.

jonathan-ostrander avatar jonathan-ostrander commented on July 26, 2024

Here's an example debug log for the rate limiter for when this happens. It looks like it's updating/resetting the limits fine and then just stops all of a sudden. I can probably take a deeper look into what's going on. My suspicion is that maybe there's a response that doesn't include the reset info in the rate limit response?

from ackcord.

jonathan-ostrander avatar jonathan-ostrander commented on July 26, 2024

Ok, I think I found the issue and I think it's due to the non-relative TilReset path. In one example I found where this was happening, the last headers that were received by my app for rate limits on the reaction path were

12:46:38.628 [AckCord-akka.actor.default-dispatcher-20] DEBUG akka.actor.typed.ActorSystem -
x-ratelimit-bucket: d6b7697c78814ecd72bb20df05517c78
x-ratelimit-limit: 1
x-ratelimit-remaining: 0
x-ratelimit-reset: 1596818798.567
x-ratelimit-reset-after: 0.001

That reset value corresponds to 12:46:38.567 which is before the call to System.currentTimeMillis() so the value for tilReset will be negative (since the system time is later than the reset time and isValid will be false so the updater is never called. Should be a simple fix.

from ackcord.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.