Skip to content

Unnecessary wait on return to the thank you page #242

Description

@TeemuVarho

Describe the bug

In https://github.com/paytrail/paytrail-for-woocommerce/blob/master/src/Gateway.php#L893-L904, it sleeps rand(0, 3) seconds (or 3 to 6 seconds with callback_mode), causing the return from the payment back to the Woocommerce thank you page to be slower. Since it works with the lower bound of the randomly generated number I can't figure out why this would be necessary.

The random sleep was originally added here CheckoutFinland/checkout-finland-for-woocommerce@3f043c3, but the commit doesn't give me a real reason why.

Steps to Reproduce

  1. Enable logging in Paytrail for Woocommerce settings page
  2. Order something on the website, using Paytrail as payment provider
  3. See the log line 'Paytrail: Wait for n seconds until processing reference x'

Expected behaviour

The thank you page load time isn't dependent on a randomly selected wait time.

Actual behaviour

All else being equal the Woocommerce thank you page loads slower or faster depending on the randomly selected wait time.

Screenshots

N/A

Additional context

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions