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

fix: adjust increment api and remove add from NumberSignal #2704

Merged
merged 11 commits into from
Sep 11, 2024

Conversation

taefi
Copy link
Contributor

@taefi taefi commented Sep 5, 2024

Description

This will introduce increment event for NumberSignal so that it is processed atomically on server based on the last seen value of NumberSignal without any retries.

Also, this refactors the increment method to incrementBy, and also removes the add methods that were introduced in #2694

This will introduce increment event for NumberSignal
so that it is processed atomically on server based on
the last seen value of NumberSignal without any retries.

Also, this refactors the increment method to incrementBy,
and also removes the add methods that were introduced in
#2694
Copy link

codecov bot commented Sep 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.34%. Comparing base (b5fd670) to head (4bd7694).
Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2704      +/-   ##
==========================================
- Coverage   94.35%   94.34%   -0.02%     
==========================================
  Files          80       80              
  Lines        2551     2545       -6     
  Branches      661      658       -3     
==========================================
- Hits         2407     2401       -6     
  Misses        140      140              
  Partials        4        4              
Flag Coverage Δ
unittests 94.34% <100.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@taefi
Copy link
Contributor Author

taefi commented Sep 9, 2024

I wonder what's the problem with codecove/project check failure. Maybe, it is confused with the file Signals.ts being renamed to NumberSignal.ts?

@taefi taefi requested a review from cromoteca September 9, 2024 07:59
Copy link

sonarcloud bot commented Sep 11, 2024

Copy link
Contributor

@cromoteca cromoteca left a comment

Choose a reason for hiding this comment

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

LGTM! Just two minor things to report, feel free to ignore.

@@ -134,7 +134,7 @@ public void constructor_withJsonInvalidEventType_shouldThrowInvalidEventTypeExce
StateEvent.InvalidEventTypeException.class,
() -> new StateEvent<>(json, String.class));

String expectedMessage = "Invalid event type invalidType. Type should be either of: [SNAPSHOT, SET, REPLACE, REJECT]";
String expectedMessage = "Invalid event type invalidType. Type should be either of: [SNAPSHOT, SET, REPLACE, REJECT, INCREMENT]";
Copy link
Contributor

Choose a reason for hiding this comment

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

"either of" is rather used with two options. Should be "one of".


private ObjectNode createIncrementEvent(String value) {
var setEvent = new StateEvent<>(UUID.randomUUID().toString(),
StateEvent.EventType.INCREMENT, Double.parseDouble(value));
Copy link
Contributor

Choose a reason for hiding this comment

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

valueOf is slightly better than parseDouble here (IDE suggestion)

@cromoteca
Copy link
Contributor

Sorry @platosha the fact that I requested a new review from you is an unwanted mouse click.

@platosha platosha merged commit 6485d1a into main Sep 11, 2024
14 of 15 checks passed
@platosha platosha deleted the taefi/fix-increment-and-remove-add-from-numbersignal branch September 11, 2024 12:38
@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with Hilla 24.5.0.alpha15 and is also targeting the upcoming stable 24.5.0 version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants