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

Changing internal structure of EventListener so it can be unit tested #225

Merged
merged 1 commit into from
Dec 18, 2023

Conversation

zajko
Copy link
Contributor

@zajko zajko commented Dec 12, 2023

  • Pulling out building connections from EventListener so the code is less complex
  • Getting rid of #[allow(clippy::too_many_lines)] for handle_rejection and stream_to_client
  • Fixing given_sse_connection_when_no_data_should_fail() unit test - it would hang once every 40-60 runs due to a race condition in setting up the mock sse server

@zajko zajko force-pushed the code_debt_removal_pt_3 branch 4 times, most recently from afdd297 to 689f551 Compare December 14, 2023 20:32
@zajko zajko requested a review from zacshowa December 14, 2023 20:34
@zajko zajko force-pushed the code_debt_removal_pt_3 branch 3 times, most recently from 2b015c5 to ae1a4b9 Compare December 15, 2023 12:06
@zajko zajko requested a review from Fraser999 December 15, 2023 12:28
Copy link
Contributor

@zacshowa zacshowa left a comment

Choose a reason for hiding this comment

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

LGTM!

let guard = last_event_id_for_filter.lock().await;

for filter in filters {
let mut start_from_event_id = guard.get(&filter).copied();
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe for this situation specifically you could handle the case where guard.get(&filter) is none by changing this line to
let mut start_from_event_id = guard.get(&filter).copied().or(Some(0));
I believe they should be functionally equivalent, so I think whichever you think is more readable would be fine.

@zajko zajko force-pushed the code_debt_removal_pt_3 branch from ae1a4b9 to aef31dc Compare December 18, 2023 13:47
@zajko zajko merged commit 41f6585 into casper-network:dev Dec 18, 2023
2 checks passed
@zajko zajko deleted the code_debt_removal_pt_3 branch December 19, 2023 12:47
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.

2 participants