Skip to content

api hanging #15

@aboveyunhai

Description

@aboveyunhai

hi, I have such simple setup for testing:

import requests

_tauri_plugin_functions = ["greet_python", "python_example"]

def greet_python(rust_var):
  return str(rust_var) + " from python"

def python_example(a):
  try:
    requests.get('https://httpbin.org/basic-auth/user/pass', auth=('user', 'pass'), timeout=2)
  except Exception as e:
    print(f"An unexpected error occurred: {e}")
  return 400

then on the frontend side:

<button
  onClick={async () => {
    try {
     const result = await callFunction("greet_python", ["something"]); // this one is always fine
     console.log(result);
     const result1 = await callFunction("python_example", [""]);
      console.log(result1);
    } catch (e) {
      console.error(e);
    }
  }}
>
call from python
</button>

Then I rapidly click the button, it will hang.
Initially I though it's async issue. but there is no error everywhere, the button just breaks. Any reason?

timeout=2 from python side does nothing, js didn't catch any eror.

The only thing I know it's that if I click before the await callFunction("python_example", [""]); finished, it stucks and can't never be recovered

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions