Skip to content

Conversation

@cwaldren-ld
Copy link
Contributor

@cwaldren-ld cwaldren-ld commented Jun 13, 2023

Augments event processor with context-key deduplication abilities using an LRU cache.

Since the implementation is shared between server/client, I use if constexpr on the SDK template to enable the behavior only on server-side SDKs.

Cache eviction behavior subject to ongoing discussion.

@shortcut-integration
Copy link

This pull request has been linked to Shortcut Story #206551: Update EventProcessor for server SDK.

event.creation_date,
filter_.filter(event.context)});
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the actual change (1/2), not sure why the diff chunk is so large.

if constexpr (std::is_same<SDK,
config::shared::ServerSDK>::value) {
context_key_cache_.Notice(event.context.CanonicalKey());
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other change (2/2).

@cwaldren-ld cwaldren-ld requested a review from kinyoklion June 13, 2023 19:39
@cwaldren-ld cwaldren-ld requested a review from kinyoklion June 13, 2023 21:18
@@ -0,0 +1,32 @@
#include <launchdarkly/events/lru_cache.hpp>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filename of this one is still context_key_cache.
But maybe if this cache is only for strings, then it doesn't need to be generic.

(Big segments, if we do it at some point has three states. Basically a tribool. Included in the segment, not included in the segment, or it doesn't exist. So when it isn't part of the segment we still cache that.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uhg, sorry for the churn. Renamed to lru_cache and renamed the test file as well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No biggie.

@cwaldren-ld cwaldren-ld merged commit 420d7a2 into server-side Jun 14, 2023
@cwaldren-ld cwaldren-ld deleted the cw/sc-206551/event-processor-changes branch June 14, 2023 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants