You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by se...@apache.org on 2021/12/20 12:51:44 UTC
[incubator-ponymail-foal] 01/02: Simplify
This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
commit 70de0e188d52ef300e31c9d3abf952bef44650d4
Author: Sebb <se...@apache.org>
AuthorDate: Mon Dec 20 12:51:18 2021 +0000
Simplify
---
server/main.py | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/server/main.py b/server/main.py
index 7288429..6f31a44 100644
--- a/server/main.py
+++ b/server/main.py
@@ -206,12 +206,10 @@ class Server(plugins.server.BaseServer):
await plugins.background.run_tasks(self)
def run(self):
- loop = asyncio.get_event_loop()
try:
- loop.run_until_complete(self.server_loop())
+ asyncio.run(self.server_loop())
except KeyboardInterrupt:
pass
- loop.close()
if __name__ == "__main__":
Re: [incubator-ponymail-foal] 01/02: Simplify
Posted by sebb <se...@gmail.com>.
On Wed, 29 Dec 2021 at 17:41, Daniel Gruno <hu...@apache.org> wrote:
>
> On 20/12/2021 06.51, sebb@apache.org wrote:
> > This is an automated email from the ASF dual-hosted git repository.
> >
> > sebb pushed a commit to branch master
> > in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
> >
> > commit 70de0e188d52ef300e31c9d3abf952bef44650d4
> > Author: Sebb <se...@apache.org>
> > AuthorDate: Mon Dec 20 12:51:18 2021 +0000
> >
> > Simplify
> > ---
> > server/main.py | 4 +---
> > 1 file changed, 1 insertion(+), 3 deletions(-)
> >
> > diff --git a/server/main.py b/server/main.py
> > index 7288429..6f31a44 100644
> > --- a/server/main.py
> > +++ b/server/main.py
> > @@ -206,12 +206,10 @@ class Server(plugins.server.BaseServer):
> > await plugins.background.run_tasks(self)
> >
> > def run(self):
> > - loop = asyncio.get_event_loop()
> > try:
> > - loop.run_until_complete(self.server_loop())
> > + asyncio.run(self.server_loop())
>
> This breaks foal badly when running multiple instances, as they will all
> attempt to attach themselves to the same master loop, so I've reverted
> the code.
I changed it partly because I was seeing the following:
/server/main.py:215: DeprecationWarning: There is no current event loop
loop = asyncio.get_event_loop()
See:
https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.get_event_loop
The call will likely fail when it becomes an alias for
get_running_loop(), so I think it needs to be fixed.
>
> > except KeyboardInterrupt:
> > pass
> > - loop.close()
> >
> >
> > if __name__ == "__main__":
>
Re: [incubator-ponymail-foal] 01/02: Simplify
Posted by Daniel Gruno <hu...@apache.org>.
On 20/12/2021 06.51, sebb@apache.org wrote:
> This is an automated email from the ASF dual-hosted git repository.
>
> sebb pushed a commit to branch master
> in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
>
> commit 70de0e188d52ef300e31c9d3abf952bef44650d4
> Author: Sebb <se...@apache.org>
> AuthorDate: Mon Dec 20 12:51:18 2021 +0000
>
> Simplify
> ---
> server/main.py | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/server/main.py b/server/main.py
> index 7288429..6f31a44 100644
> --- a/server/main.py
> +++ b/server/main.py
> @@ -206,12 +206,10 @@ class Server(plugins.server.BaseServer):
> await plugins.background.run_tasks(self)
>
> def run(self):
> - loop = asyncio.get_event_loop()
> try:
> - loop.run_until_complete(self.server_loop())
> + asyncio.run(self.server_loop())
This breaks foal badly when running multiple instances, as they will all
attempt to attach themselves to the same master loop, so I've reverted
the code.
> except KeyboardInterrupt:
> pass
> - loop.close()
>
>
> if __name__ == "__main__":