commanded-ecto-projections icon indicating copy to clipboard operation
commanded-ecto-projections copied to clipboard

Improvement: Skip noop events

Open sascha-wolf opened this issue 6 years ago • 2 comments

This PR does two things:

  1. it refactors the ecto.ex file a bit to make it more readable (30b90ab and 57279c1)
  2. it adds logic to ignore "noop" events (everything else)

Noop events are events which return an unaltered multi struct. In our project there are a few projections which determine whether or not an update is necessary based whether or not certain entries have been created before by the projection. If no update is necessary the projection simply returns the unaltered multi struct.

In this case the projection now treats the noop events the same as ignored events and never does a DB roundtrip. This will increase performance for noop events considerably. To allow users to handle noop cases specifically the projection now has a new call_after_update_for_noop? option which, as the name suggests, adds a call to after_update with the :noop atom instead of changes.

TODO

  • [ ] Update the README and docs

sascha-wolf avatar Apr 15 '19 16:04 sascha-wolf

@Zeeker If this PR is code complete I'm happy to merge it in. Just let me know.

slashdotdash avatar May 20 '19 09:05 slashdotdash

Uh, I totally forgot about this. I'll see that I finish this soon.

sascha-wolf avatar May 20 '19 10:05 sascha-wolf