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

feat!: Switch to a single Producer, wrapped in an API singleton #32

Merged
merged 9 commits into from
Aug 31, 2022

Commits on Aug 26, 2022

  1. Configuration menu
    Copy the full SHA
    214e360 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a9c6ac7 View commit details
    Browse the repository at this point in the history
  3. feat!: Switch to a single Producer, wrapped in an API singleton

    Purpose:
    
    - Revisit #16 since I
      finally figured out a clean way to have a single producer.
    - Reduce the burden on future code that will need to adjust how polling
      is done (#31) and
      maybe handle shutdown (#11)
    - Prepare for configurable implementation loading, which will need a
      singleton and getter: openedx/openedx-events#87
    - Get rid of the `sync` argument (which didn't fit the abstraction) and
      move it to a dedicated method.
    
    Relying code should now call `get_producer().send(...)` rather than
    `send_to_event_bus(...)`. The return value is an object that wraps a
    `Producer` instance (not a `SerializingProducer`) and that handles the
    serialization itself.
    
    Serialization logic is moved to a cached `get_serializers(...)` that
    expands upon the previous `get_serializer` function; it now returns a pair
    of key and value serializers. This also acts as a patch point for
    mocking. I'd like to test the serializers themselves, but they want to
    talk to a server.
    
    `send_to_event_bus` gets a shorter name (now it's just a `send` method)
    and loses the `sync` keyword argument; there is instead now a
    `pre_shutdown` method.
    timmc-edx committed Aug 26, 2022
    Configuration menu
    Copy the full SHA
    a4b9e52 View commit details
    Browse the repository at this point in the history

Commits on Aug 29, 2022

  1. fixup! Tweaks from PR review

    - Fix comment re: client caching
    - Use `cache` instead of `lru_cache` (should only ever have one value
      anyhow)
    timmc-edx committed Aug 29, 2022
    Configuration menu
    Copy the full SHA
    c5fe89a View commit details
    Browse the repository at this point in the history
  2. fixup! Restore use of lru_cache

    functools.cache is new in Python 3.9. :-)
    timmc-edx committed Aug 29, 2022
    Configuration menu
    Copy the full SHA
    1278f99 View commit details
    Browse the repository at this point in the history

Commits on Aug 31, 2022

  1. fixup! Rename pre_shutdown -> prepare_for_shutdown

    Also update CHANGELOG date prediction.
    timmc-edx committed Aug 31, 2022
    Configuration menu
    Copy the full SHA
    2e09d6d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    de012d5 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    3e63553 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    46f3c91 View commit details
    Browse the repository at this point in the history