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

Session Transaction Manager bugfixes and enhancements #492

Merged

Conversation

jacobarriola
Copy link
Contributor

@jacobarriola jacobarriola commented May 12, 2021

Your checklist for this pull request

  • Make sure you are making a pull request against the develop branch (left side). Also you should start your branch off our develop.
  • Make sure you are requesting to pull request from a topic/feature/bugfix/devops branch (right side). Don't pull request from your master!
  • Have you ensured/updated that CLI tests to extend coverage to any new logic. Learn how to modify the tests here.

What does this implement/fix? Explain your changes.

This PR intends to add enhancements and bug fixes to the Session Transaction Manager. Specifically:

  1. fix null value for _customer_id when setting/getting the transients. As is all transients are getting set to the same id. As a result, if one error occurs, that makes it an error for all subsequent requests.
  2. fix null value when setting $snapshot in the transaction. $snapshot isn't used at the moment, but it's incorrectly getting set.
  3. add a timing mechanism to prevent infinite loops after a mutation error. As is, if there's an error, the transaction hangs around and becomes stale. Subsequent request will keep looping over and over until the server crashes because there is no mechanism to invalidate the stale transaction. A filterable timestamp provides a mechanism to invalidate the stale transaction.

Does this close any currently open issues?

#494

Where has this been tested?

  • WooGraphQL Version: 0.8.1
  • WPGraphQL Version: 1.1.3
  • WordPress Version: 5.7.1
  • WooCommerce Version: 4.9.2

@kidunot89 kidunot89 self-requested a review May 19, 2021 01:45
The customer id is stored in the the session_handler instance. As a result the same transient was getting set for all users, which was causing errors when a hanging transaction was left.
The session data (snapshot) is a property of the session_handler, not of the existing instance. As a result, the snapshot was always returning null.
There are instances where a stale transaction stays around do to an error in the mutation. As a result, the recursive update_transaction_queue method will continue to run over and over, causing an inifinte loop and potentially crashing the server.

This attempts to add a timestamp once the transaction is validated when checking via the timestamp and will remove it from the queue.
@kidunot89 kidunot89 force-pushed the bugfix/session-transaction-manager branch from 44f8b12 to b4a158b Compare June 14, 2021 16:19
@kidunot89 kidunot89 merged commit 71be042 into wp-graphql:develop Jun 14, 2021
@kidunot89 kidunot89 added the bugfix Implements bugfix label Jun 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix Implements bugfix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants