Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@hfmw
Copy link
Contributor

@hfmw hfmw commented Nov 11, 2018

Resolves #4786
Impact: minor
Type: bugfix

Issue

Refactor of cartCleanupJob, which currently doesn't run.

Solution

  • Refactored for the new cart system.
  • Moment lazyload also wasn't working, so this is now imported directly.
  • Using job.progress instead of job.done - this fixes "job not found" errors, and uses the Job package as intended.

Breaking changes

N/A

Testing

  1. Set the cleanup schedule to a small time period
  2. Observe old carts removed
  3. Observe accounts without emails attached are removed

@brent-hoover brent-hoover changed the base branch from master to release-2.0.0-rc.6 November 11, 2018 10:55
@aldeed aldeed changed the base branch from release-2.0.0-rc.6 to release-2.0.0-rc.7 November 12, 2018 17:34
@aldeed
Copy link
Contributor

aldeed commented Nov 12, 2018

@willmoss1000 Thanks for tackling this! The direct import of moment is fine, but the code that deletes the linked account if it has no email is no longer necessary and won't do anything. Anonymous carts no longer have an accountId on them, and carts that do have an accountId will never be linked to an account with no email. The use of "anonymous accounts" is effectively phased out, even though the old UI may still create them for now.

@aldeed
Copy link
Contributor

aldeed commented Nov 12, 2018

Probably the whole thing could be simplified to Cart.remove({ updatedAt: { $lte: olderThan } }, { multi: true }) now.

@aldeed aldeed requested a review from brent-hoover November 12, 2018 17:44
@spencern
Copy link
Contributor

@aldeed @zenweasel @willmoss1000 what do we need to do to get this moving?

@hfmw
Copy link
Contributor Author

hfmw commented Nov 30, 2018

@aldeed what you've suggested makes this simple. I've updated the PR accordingly.

@impactmass impactmass changed the base branch from release-2.0.0-rc.7 to release-2.0.0-rc.8 November 30, 2018 16:15
@aldeed aldeed merged commit d8e2e3a into reactioncommerce:release-2.0.0-rc.8 Dec 6, 2018
@aldeed
Copy link
Contributor

aldeed commented Dec 6, 2018

Thanks @willmoss1000 !

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