-
Notifications
You must be signed in to change notification settings - Fork 104
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
[Question] Using threading.Thread
in a Function
#755
Comments
Hi @Stael, thanks for providing the example and sharing your scenario. |
Hi @Hazhzeng, Here are more details on what actually happens. We are using:
I do not think that the re-open time is linked to the ColdStart, here is why:
Here is a scaffolding of our implementation: def execute_in_thread(f):
def wrapper(*args, **kwargs):
thread = Thread(target=f, args=args, kwargs=kwargs)
thread.start()
return wrapper
@execute_in_thread
def send_data(client: EventHubProducerClient, data: str):
client.send_batch([EventData(data)]) Given our configuration (Linux / App service plan / Premium v2 pricing tier), can you ensure me that there are no potential caveats with our use of the Python builtin threading library within an Azure Function app ? Thanks a lot ! |
Thanks @Stael for the quick turn around. If your function app is running on Premium V2, I don't see any caveats. |
Awesome ! Thank you very much for your help @Hazhzeng, really appreciate it :) |
Hello !
We are currently using several AzureFunctions in production.
Use case:
azure-eventhub
package. (Previously we usedconfluent-kafka
and theKafka API for Event Hub
but recently we have started facing unsolvable issues (because ofKafka API for Event Hub
behavior) so we migrated toazure-eventhub
package smoothly.)Usage:
Issue:
Question:
client.send_batch([EventData(_SOME_DATA_)])
in a thread (threading.Thread
) ? That way we can redirect the user "almost instantaneously" and "in background" we send the data to EventHub.Thanks !
The text was updated successfully, but these errors were encountered: