File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,21 @@ def run_in_thread(
47
47
key : str | None = None ,
48
48
ex = 60 ,
49
49
):
50
+ """
51
+ Creates a new thread to run `fn(*args, **kwargs)`.
52
+
53
+ Returns:
54
+ - `None` until the function call is executing.
55
+ - The returned value of `fn(*args, **kwargs)` on the next call.
56
+ If `cache=True`, the same value will be cached in the `session_state`.
57
+ Further calls to `run_in_thread(fn, ...)` will return the same value
58
+ until the `session_state` is reset (e.g. with a page refresh).
59
+
60
+ Note that `fn.__name__` is used in the cache key. Because of this,
61
+ it won't work with `lambda`s and closures that don't have a fixed
62
+ value for `__name__`.
63
+ """
64
+
50
65
if key is None :
51
66
key = f"{ run_in_thread .__name__ } /{ fn } "
52
67
You can’t perform that action at this time.
0 commit comments