Skip to content

DATACOUCH-608 - propagate expiry option and annotation to insert and … #259

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

Closed

Conversation

mikereiche
Copy link
Collaborator

…upsert calls

  • You have read the Spring Data contribution guidelines.
  • There is a ticket in the bug tracker for the project in our JIRA.
  • You use the code formatters provided here and have them applied to your changes. Don’t submit any formatting related changes.
  • You submit test cases (unit or integration tests) that back your changes.
  • You added yourself as author in the headers of the classes you touched. Amend the date range in the Apache license header if needed. For new types, add the license header (copy from another file and set the current year only).

@mikereiche mikereiche requested a review from daschl September 14, 2020 21:50
@mikereiche mikereiche force-pushed the datacouch_608_propagate_expiry_option_annotation branch from ff06fb5 to c846ec4 Compare September 15, 2020 00:09

@Override
public InsertByIdWithDurability<T> withExpiry(final Duration expiry) {
return new ExecutableInsertByIdSupport<>(template, domainType, collection, persistTo, replicateTo,
Copy link
Contributor

Choose a reason for hiding this comment

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

Assert.notNull(expiry,..) checking might make sense here

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added.


@Override
public UpsertByIdWithDurability<T> withExpiry(final Duration expiry) {
Assert.notNull(persistTo, "PersistTo must not be null.");
Copy link
Contributor

Choose a reason for hiding this comment

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

these assertions are checking the wrong thing, copy/paste err?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes. Replaced with correct check on expiry. Also changed initialization to use expiry of Duration.ofSeconds(0) instead of null for consistency.

try {
User inserted = couchbaseTemplate.insertById(User.class).withExpiry(Duration.ofSeconds(1)).one(user);
assertEquals(user, inserted);
sleepSecs(2);
Copy link
Contributor

Choose a reason for hiding this comment

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

are these sleeps needed in those places? kv should not be eventually consistent but rather directly

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The sleeps are need to allow the document to expire.

Copy link
Contributor

Choose a reason for hiding this comment

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

of course 🤦

@mikereiche mikereiche force-pushed the datacouch_608_propagate_expiry_option_annotation branch from c846ec4 to bd0252a Compare September 15, 2020 16:52
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