Skip to content

Commit

Permalink
move to gevent
Browse files Browse the repository at this point in the history
  • Loading branch information
fredclausen committed Oct 24, 2024
1 parent 0844321 commit be36051
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion rootfs/etc/s6-overlay/scripts/webapp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if [[ ${ENABLE_WEB,,} =~ true ]]; then
-b "0.0.0.0:8888" \
-w 1 \
--no-sendfile \
-k eventlet \
-k gevent \
acarshub:app \
--timeout 120 \
2>&1 | stdbuf -oL sed --unbuffered '/^$/d' | \
Expand Down
23 changes: 11 additions & 12 deletions rootfs/webapp/acarshub.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
# You should have received a copy of the GNU General Public License
# along with acarshub. If not, see <http://www.gnu.org/licenses/>.

import eventlet

eventlet.monkey_patch()
import acarshub_helpers # noqa: E402
import acarshub_configuration # noqa: E402
import acarshub_logging # noqa: E402
Expand Down Expand Up @@ -362,14 +359,14 @@ def message_listener(message_type=None, ip="127.0.0.1", port=None):
acarshub_logging.log(
"Reassembly successful, message not skipped after all!",
f"{message_type.lower()}Generator",
level=LOG_LEVEL["DEBUG"]
level=LOG_LEVEL["DEBUG"],
)
except Exception as e:
# reassembly didn't work, don't do anything but print an error when debug is enabled
acarshub_logging.log(
f"Reassembly failed {e}: {combined}",
f"{message_type.lower()}Generator",
level=LOG_LEVEL["WARNING"]
level=LOG_LEVEL["WARNING"],
)

# forget the partial message, it can't be useful anymore
Expand All @@ -389,7 +386,9 @@ def message_listener(message_type=None, ip="127.0.0.1", port=None):
# last element in the list, could be a partial json object
partial_message = part
acarshub_logging.log(
f"Skipping Message: {part}", f"{message_type.lower()}Generator", LOG_LEVEL["DEBUG"]
f"Skipping Message: {part}",
f"{message_type.lower()}Generator",
LOG_LEVEL["DEBUG"],
)
continue
except Exception as e:
Expand Down Expand Up @@ -432,9 +431,7 @@ def message_listener(message_type=None, ip="127.0.0.1", port=None):
if not acarshub_configuration.QUIET_MESSAGES:
print(f"MESSAGE:{message_type.lower()}Generator: {msg}")

client_message = generateClientMessage(
que_type, formatted_message
)
client_message = generateClientMessage(que_type, formatted_message)

# add to recent message que for anyone fresh loading the page
list_of_recent_messages.append(client_message)
Expand All @@ -460,9 +457,11 @@ def init_listeners(special_message=""):

# show log message if this is container startup
acarshub_logging.log(
"Starting Data Listeners"
if special_message == ""
else "Checking Data Listeners",
(
"Starting Data Listeners"
if special_message == ""
else "Checking Data Listeners"
),
"init",
level=LOG_LEVEL["INFO"] if special_message == "" else LOG_LEVEL["DEBUG"],
)
Expand Down
4 changes: 2 additions & 2 deletions rootfs/webapp/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
eventlet==0.37.0
Flask==3.0.3
Flask-SocketIO==5.4.1
gunicorn[eventlet]==23.0.0
gevent==24.10.3
gunicorn[gevent]==23.0.0
requests==2.32.3
rrdtool==0.1.16
schedule==1.2.2
Expand Down

0 comments on commit be36051

Please sign in to comment.