question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Join to non-blocking AE server thread

See original GitHub issue

I would like to print a logging statement from my SCP after it has started.

Now I print the “… SCP has started” message before calling the start_server() function with block=True. This is not ideal, because even if things go wrong when starting the service, a message about a “successful start” will be in the logs. (I do check if the port is available, but there can be other issues that I cannot foresee.)

I think something like this would be nice:

threaded_association_server = ae.start_server((bind_address, port), block=False)
print("SCP has started.")
threaded_association_server.join()

As I see, the thread is created as a local variable in AE.start_server() and it is not stored anywhere, so I cannot call join() now.

Does this make sense?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
scaramallioncommented, Apr 29, 2020

I’m working towards it, hopefully sometime next month.

0reactions
Spenhouetcommented, May 31, 2020

I will report back as soon as we tested the new method.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Simple non-blocking server - java - Stack Overflow
For the purpose of writing an instant messenger program, I am trying to make up a simple server class which will run in...
Read more >
In simple terms, what is blocking and non-blocking IO? - Quora
This means that a thread initiates an IO operation (e.g. a thread in service A calling service B's REST API), and then switches...
Read more >
Guides::Cookbook - Cooking with Mojolicious
Mojolicious contains a very portable non-blocking I/O HTTP and WebSocket server with Mojo::Server::Daemon. It is usually used during development and in the ...
Read more >
Impossible scenario for non-blocking timeout and constant space ...
Timeoutcapable spin locks allow a thread to abandon its attempt to acquire a lock; they are used widely in real-time systems to avoid...
Read more >
Chapter 3 - Advanced Request-Reply Patterns - ZeroMQ Guide
Think of REQ and DEALER sockets as “clients” and REP and ROUTER sockets as “servers”. Mostly, you'll want to bind REP and ROUTER...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found