Git Product home page Git Product logo

kinto-megaphone's Introduction

kinto-megaphone's People

Contributors

dependabot-preview[bot] avatar dependabot-support avatar glasserc avatar leplatrem avatar

Watchers

 avatar  avatar  avatar  avatar

kinto-megaphone's Issues

Extract fixtures to a tests.support module

Some of the tests in test_listeners aren't really about the listener. I just dumped them in there because I wanted to re-use the fixture. Split everything up a little bit more.

Support a mode where we don't push preview buckets

Right now we push a notification on e.g. every change to the monitor-changes bucket. That means we trigger when records are first copied into the main-preview bucket as well as after they are approved and copied into the main bucket. However, the version ID is the same in both cases, so megaphone doesn't treat the second push as an actual push. Instead, the client gets notified when the preview collection is updated. This isn't ideal.

Discussing this with Mat on IRC, here are some proposed approaches:

  • Maybe the monitor/changes collection should get a new ETag when the records are copied to main. But this seems hard because the records should be the same records from the main-preview collection, and the ETag comes from the latest last_modified in the collection.
  • Maybe we could remove the preview buckets from the monitor/changes resource. But this is inconvenient because the client relies on finding things in monitor/changes to load them, even for preview collections.
  • Finally, maybe we can exclude the preview buckets from kinto-megaphone events. This means setting up a new type of listener that is somehow smart enough to decompose events on the kinto-changes collection, filter out records that are relevant to it, and perform kinto-megaphone updates only sometimes. This seems like the most plausible solution, although it requires a certain amount of work.

The filtering proposed here goes a bit beyond the notification filtering proposed in https://kinto.readthedocs.io/en/stable/tutorials/notifications-custom.html and Kinto/kinto#1499, so maybe we should just build something into this package.

Be robust against startup during a migration

Currently the listener runs at startup and makes some database queries to try to figure out what the "current" version of the megaphone version for monitor/changes should be. Unfortunately, during a migration, the application comes up before the migration runs, and the listener may not be able to execute the queries it wants to. Instead, is it maybe possible to do queries in a "just-in-time" fashion on a per-request basis, perhaps in a ResourceRead event handler?

/cc @leplatrem @autrilla

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.