Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MongoDB adapter - SlidingTimeWindow support #88

Open
ahmad-elassuty opened this issue Jul 22, 2021 · 2 comments
Open

MongoDB adapter - SlidingTimeWindow support #88

ahmad-elassuty opened this issue Jul 22, 2021 · 2 comments

Comments

@ahmad-elassuty
Copy link

ahmad-elassuty commented Jul 22, 2021

Thanks for this great package!

I'm a bit confused about MongoDB implementation. It is stated in the README that an adapter can support either SlidingTimeWindow or TumblingTimeWindow, however this is not the case for MongoDB adapter as far as I can tell from the implemented interfaces.

I believe MongoDB adapter does not support SlidingTimeWindow the same way Redis Adapter does. It rather resets the stats every whole time window (more like TumblingTimeWindow but without comparing to the previous window). I came to this conclusion after checking the adapter data model and the Rate strategy and I was wondering if that is by design or a bug?

@ackintosh
Copy link
Owner

Thank you for this issue! I'll take a look for this issue on this weekend. Sorry for keeping you waiting. 🙇

@ackintosh
Copy link
Owner

Oh it's a bug. 💦 You are completely right. The sliding timewindow implementation of MongoDB adapter is similar to TumblingTimeWindow but imperfect as you pointed.

  • remove the marker interface SlidingTimeWindowInterface from the adapter
  • add support for expire documents (like memcached) to avoid overflowing

I'll work on this but it may take some time because I'm not familiar with MongoDB.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants