Skip to content

Commit ae244f2

Browse files
authored
Update monitior (#282)
1 parent b061e12 commit ae244f2

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

monitor/main.py

+16-11
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def read_publications(version, path):
1818
files = [[x[0], list(filter(lambda file: file.endswith(".pom"), x[2]))[0]] for x in os.walk(path) if
1919
version in x[0]]
2020
paths = list(map(lambda tpl: Path(f"{tpl[0].removeprefix(path)}/{tpl[1]}"), files))
21+
paths.sort(key=lambda path: path.base)
2122
return paths
2223

2324

@@ -121,17 +122,21 @@ async def update_weather(self, path: Path) -> None:
121122
url = f"{REPO_URL}/{path.full}"
122123
async with httpx.AsyncClient() as client:
123124
response = await client.get(url)
124-
if response.status_code == 200:
125-
weather_widget = self.query_one(f"#{path.calculated_id}", Static)
126-
weather_widget.add_class("found")
127-
if self.hidden:
128-
weather_widget.add_class("hidden")
129-
weather_widget.update(f"{path.base} - UPLOADED")
130-
await self.lock.acquire()
131-
self.progress += 1
132-
self.query_one("#progress-bar", ProgressBar).update(progress=self.progress)
133-
self.lock.release()
134-
else:
125+
try:
126+
if response.status_code == 200:
127+
weather_widget = self.query_one(f"#{path.calculated_id}", Static)
128+
weather_widget.add_class("found")
129+
if self.hidden:
130+
weather_widget.add_class("hidden")
131+
weather_widget.update(f"{path.base} - UPLOADED")
132+
await self.lock.acquire()
133+
self.progress += 1
134+
self.query_one("#progress-bar", ProgressBar).update(progress=self.progress)
135+
self.lock.release()
136+
else:
137+
await asyncio.sleep(1)
138+
await self.update_weather(path)
139+
except:
135140
await asyncio.sleep(1)
136141
await self.update_weather(path)
137142

0 commit comments

Comments
 (0)