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

[jpa] Do not log failure to persist item with duplicate timestamp as error #15978

Merged
merged 3 commits into from Jan 30, 2024

Conversation

ccutrer
Copy link
Contributor

@ccutrer ccutrer commented Nov 29, 2023

in case the user manually added a UNIQUE constraint to the database, openHAB might send duplicate timestamps.

effectively this means the first attempt is kept, while others are dropped. as long as you're using sub-second timestamps, this shouldn't be an issue - the state updates truly should be duplicates

in case the user manually added a UNIQUE constraint to the database,
openHAB might send duplicate timestamps.

effectively this means the first attempt is kept, while others are
dropped. as long as you're using sub-second timestamps, this shouldn't
be an issue - the state updates truly should be duplicates

Signed-off-by: Cody Cutrer <cody@cutrer.us>
@ccutrer ccutrer requested a review from a team as a code owner November 29, 2023 23:00
Copy link
Contributor

@jlaur jlaur left a comment

Choose a reason for hiding this comment

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

Thanks! I have only one minor comment.

@ccutrer
Copy link
Contributor Author

ccutrer commented Jan 9, 2024

@jlaur : anything else?

@jlaur
Copy link
Contributor

jlaur commented Jan 10, 2024

anything else?

I don't think so, only the comment already posted. I don't know if I missed anything, but I only get notifications on commits and comments, not when a comment is only marked as resolved.

Signed-off-by: Cody Cutrer <cody@cutrer.us>
@ccutrer
Copy link
Contributor Author

ccutrer commented Jan 10, 2024

🤦 🤦 🤦

My bad. I had addressed your comment locally. And even tried to push. But re-pushing just barely I realize for some reason my local branch didn't have its upstream set, so it just gave an error, and I hadn't noticed. This makes so much more sense why there has been no action! I apologize!

@jlaur
Copy link
Contributor

jlaur commented Jan 10, 2024

My bad. I had addressed your comment locally. And even tried to push. But re-pushing just barely I realize for some reason my local branch didn't have its upstream set, so it just gave an error, and I hadn't noticed. This makes so much more sense why there has been no action! I apologize!

No worries! Next time please don't hestitate to ping me if you think I've forgotten about your PR - it happens. 😉

@jlaur jlaur changed the title [jpa] ignore EntityExistsException [jpa] Do not log failure to persist item with duplicate timestamp as error Jan 10, 2024
@jlaur jlaur added the enhancement An enhancement or new feature for an existing add-on label Jan 10, 2024
@ccutrer
Copy link
Contributor Author

ccutrer commented Jan 30, 2024

Ping @jlaur : I think I addressed your comments.

@jlaur
Copy link
Contributor

jlaur commented Jan 30, 2024

Ping @jlaur : I think I addressed your comments.

Did you see this?

…persistence/jpa/internal/JpaPersistenceService.java

Co-authored-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Cody Cutrer <cody@cutrer.us>
Copy link
Contributor

@jlaur jlaur left a comment

Choose a reason for hiding this comment

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

LGTM

@jlaur jlaur merged commit 6bd0c28 into openhab:main Jan 30, 2024
3 checks passed
@jlaur jlaur added this to the 4.2 milestone Jan 30, 2024
@ccutrer ccutrer deleted the jpa-ignore-entity-exists branch January 30, 2024 21:43
@ccutrer
Copy link
Contributor Author

ccutrer commented Jan 30, 2024

Thanks! Sorry again for the false starts!

ErikDB87 pushed a commit to ErikDB87/openhab-addons-openweathermap that referenced this pull request Jan 31, 2024
…error (openhab#15978)

* [jpa] ignore EntityExistsException

in case the user manually added a UNIQUE constraint to the database,
openHAB might send duplicate timestamps.

effectively this means the first attempt is kept, while others are
dropped. as long as you're using sub-second timestamps, this shouldn't
be an issue - the state updates truly should be duplicates

Signed-off-by: Cody Cutrer <cody@cutrer.us>
Signed-off-by: Erik De Boeck <deboeck.erik@gmail.com>
austvik pushed a commit to austvik/openhab-addons that referenced this pull request Mar 27, 2024
…error (openhab#15978)

* [jpa] ignore EntityExistsException

in case the user manually added a UNIQUE constraint to the database,
openHAB might send duplicate timestamps.

effectively this means the first attempt is kept, while others are
dropped. as long as you're using sub-second timestamps, this shouldn't
be an issue - the state updates truly should be duplicates

Signed-off-by: Cody Cutrer <cody@cutrer.us>
Signed-off-by: Jørgen Austvik <jaustvik@acm.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement or new feature for an existing add-on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants