mirror of
https://github.com/lbatalha/rnmon.git
synced 2025-12-22 10:27:12 +00:00
Add linting actions (#2)
* add ruff linting gh action * fix ruff linting errors * add filtering to gh action
This commit is contained in:
23
.github/workflows/linting.yml
vendored
Normal file
23
.github/workflows/linting.yml
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
name: Linting
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '*'
|
||||
tags:
|
||||
- "[0-9]+.[0-9]+.[0-9]+*"
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
paths-ignore:
|
||||
- .gitignore
|
||||
- LICENSE
|
||||
- '*.example'
|
||||
- '**.example'
|
||||
jobs:
|
||||
ruff:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: astral-sh/ruff-action@v3
|
||||
with:
|
||||
src: "./src"
|
||||
@@ -19,6 +19,8 @@ keywords = ["reticulum", "monitoring", "influx", "exporter"]
|
||||
[project.scripts]
|
||||
rnmon = "rnmon.rnmon:main"
|
||||
|
||||
[tool.ruff.lint]
|
||||
|
||||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import time
|
||||
import requests
|
||||
from random import randrange
|
||||
from collections import deque
|
||||
|
||||
import RNS
|
||||
from . import MP
|
||||
@@ -29,9 +28,9 @@ class InfluxWriter:
|
||||
pass
|
||||
if data:
|
||||
RNS.log(f"[RNMon] Pushing metrics - Count: {len(data)} Time: {int(time.time() - last_push)}s", RNS.LOG_DEBUG)
|
||||
r = requests.post(self.address, headers=self.http_headers, data="\n".join(data))
|
||||
requests.post(self.address, headers=self.http_headers, data="\n".join(data))
|
||||
last_push = time.time()
|
||||
jitter = randrange(-self.flush_jitter, self.flush_jitter+1)
|
||||
time.sleep(0.2)
|
||||
|
||||
RNS.log(f"[RNMon] Stopped InfluxWriter", RNS.LOG_INFO)
|
||||
RNS.log("[RNMon] Stopped InfluxWriter", RNS.LOG_INFO)
|
||||
|
||||
@@ -2,7 +2,6 @@ import os
|
||||
import time
|
||||
|
||||
import RNS
|
||||
from . import MP
|
||||
|
||||
path_request_timeout = 30
|
||||
link_est_timeout = 30
|
||||
@@ -51,7 +50,7 @@ def on_link_closed(link: RNS.Link) -> None:
|
||||
|
||||
def ensure_path(dest_hash: bytes) -> None:
|
||||
if not RNS.Transport.has_path(dest_hash):
|
||||
RNS.log(f"[RNMon] No path to destination known. Requesting path and waiting for announce to arrive...")
|
||||
RNS.log("[RNMon] No path to destination known. Requesting path and waiting for announce to arrive...")
|
||||
RNS.Transport.request_path(dest_hash)
|
||||
start = time.time()
|
||||
while not RNS.Transport.has_path(dest_hash):
|
||||
|
||||
Reference in New Issue
Block a user