Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
HELpy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
HELpy
Commits
8e53b89a
Commit
8e53b89a
authored
2 weeks ago
by
Michał Kudela
Browse files
Options
Downloads
Patches
Plain Diff
Replace sleep with asyncio.sleep for async compatibility
parent
ef6b8c6f
Branches
kudmich/change-sleep-function
No related tags found
No related merge requests found
Pipeline
#119311
failed
2 weeks ago
Stage: static_code_analysis
Stage: build
Stage: beekeepy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
beekeepy/beekeepy/_communication/universal_notification_server.py
+5
-3
5 additions, 3 deletions
.../beekeepy/_communication/universal_notification_server.py
with
5 additions
and
3 deletions
beekeepy/beekeepy/_communication/universal_notification_server.py
+
5
−
3
View file @
8e53b89a
...
@@ -3,7 +3,6 @@ from __future__ import annotations
...
@@ -3,7 +3,6 @@ from __future__ import annotations
import
asyncio
import
asyncio
from
collections
import
defaultdict
from
collections
import
defaultdict
from
threading
import
Thread
from
threading
import
Thread
from
time
import
sleep
from
typing
import
TYPE_CHECKING
,
Any
,
Final
from
typing
import
TYPE_CHECKING
,
Any
,
Final
from
beekeepy._communication.abc.notification_handler
import
NotificationHandler
from
beekeepy._communication.abc.notification_handler
import
NotificationHandler
...
@@ -63,9 +62,12 @@ class UniversalNotificationServer(ContextSync[int]):
...
@@ -63,9 +62,12 @@ class UniversalNotificationServer(ContextSync[int]):
time_to_launch_notification_server
:
Final
[
float
]
=
0.5
time_to_launch_notification_server
:
Final
[
float
]
=
0.5
assert
self
.
__server_thread
is
None
,
"
Server thread is not None; Is server still running?
"
assert
self
.
__server_thread
is
None
,
"
Server thread is not None; Is server still running?
"
self
.
__server_thread
=
Thread
(
target
=
asyncio
.
run
,
args
=
(
self
.
__http_server
.
run
(),),
name
=
self
.
__thread_name
)
self
.
__loop
=
asyncio
.
new_event_loop
()
self
.
__server_thread
=
Thread
(
target
=
self
.
__http_server
.
run
,
args
=
(
self
.
__loop
,),
name
=
self
.
__thread_name
)
self
.
__server_thread
.
start
()
self
.
__server_thread
.
start
()
sleep
(
time_to_launch_notification_server
)
future
=
asyncio
.
run_coroutine_threadsafe
(
asyncio
.
sleep
(
time_to_launch_notification_server
),
self
.
__loop
)
future
.
result
()
return
self
.
__http_server
.
port
return
self
.
__http_server
.
port
def
close
(
self
)
->
None
:
def
close
(
self
)
->
None
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment