Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
altlinux-packages-bot
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Unitsaev
altlinux-packages-bot
Commits
60b1f1fe
Verified
Commit
60b1f1fe
authored
Mar 10, 2026
by
Kirill Unitsaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
watch: remove task status checks for faster response
parent
fe26ed3d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
56 deletions
+7
-56
watch.py
src/handlers/watch.py
+6
-31
watch.py
src/services/watch.py
+1
-25
No files found.
src/handlers/watch.py
View file @
60b1f1fe
...
...
@@ -3,12 +3,10 @@ from telegrinder.rules import Command, Argument, Text, IsPrivate, CallbackDataMa
from
telegrinder.tools.formatting
import
HTMLFormatter
from
altrepo
import
altrepo
from
config
import
TASK_URL
from
database.models
import
User
from
data.keyboards
import
watch_keyboards
from
services.utils
import
_bold
,
resolve_maintainer
from
services.watch
import
watch
as
watch_service
PER_PAGE
=
10
...
...
@@ -28,40 +26,17 @@ async def fetch_watch_packages(maintainer: str, acl: str):
return
list
(
packages
.
values
())
async
def
format_watch_entry
(
package
):
crossed
=
False
updated_in_task_message
=
""
for
status
in
[
"DONE"
,
"EPERM"
]:
try
:
data
=
await
altrepo
.
api
.
task
.
progress
.
find_tasks
(
input
=
[
package
.
pkg_name
,
"sisyphus"
,
package
.
new_version
,
status
]
)
task_id
=
data
.
tasks
[
0
]
.
task_id
updated_in_task_message
=
(
f
" (<a href='{TASK_URL}{task_id}'>{task_id}/{status}</a>)"
)
crossed
=
True
break
except
:
crossed
=
False
continue
prefix
=
"<s>"
if
crossed
else
""
suffix
=
"</s>"
if
crossed
else
""
def
format_watch_entry
(
package
):
return
HTMLFormatter
(
f
"{prefix}"
f
"{package.pkg_name}: {package.old_version} -> "
f
"<a href='{package.url.replace('.git/', '/')}'>{package.new_version}</a>"
f
"{suffix}"
f
"{updated_in_task_message}
\n
"
f
"<a href='{package.url.replace('.git/', '/')}'>{package.new_version}</a>
\n
"
)
async
def
format_watch_page
(
packages
,
offset
:
int
,
total
:
int
):
def
format_watch_page
(
packages
,
offset
:
int
,
total
:
int
):
message
=
_bold
(
"Отслеживание:
\n\n
"
)
for
package
in
packages
:
message
+=
await
format_watch_entry
(
package
)
message
+=
format_watch_entry
(
package
)
message
+=
f
"
\n
Пакеты {offset + 1}–{offset + len(packages)} из {total}"
return
message
...
...
@@ -91,7 +66,7 @@ async def watch_handler(
page
=
packages
[:
PER_PAGE
]
await
m
.
answer
(
await
format_watch_page
(
page
,
0
,
total
),
format_watch_page
(
page
,
0
,
total
),
reply_markup
=
watch_keyboards
.
watch_nav_kb
(
nickname
,
acl
,
0
,
total
,
PER_PAGE
),
)
...
...
@@ -110,7 +85,7 @@ async def watch_page_handler(
page
=
packages
[
offset
:
offset
+
PER_PAGE
]
await
cb
.
edit_text
(
await
format_watch_page
(
page
,
offset
,
total
),
format_watch_page
(
page
,
offset
,
total
),
reply_markup
=
watch_keyboards
.
watch_nav_kb
(
maintainer
,
acl
,
offset
,
total
,
PER_PAGE
),
)
await
cb
.
answer
()
src/services/watch.py
View file @
60b1f1fe
from
telegrinder.tools.formatting
import
HTMLFormatter
from
config
import
tg_api
from
config
import
TASK_URL
from
altrepo
import
altrepo
...
...
@@ -45,32 +44,9 @@ async def watch(
packages
=
list
(
packages
.
values
())
for
package
in
packages
[:
30
]:
crossed
=
False
updated_in_task_message
=
""
for
status
in
[
"DONE"
,
"EPERM"
]:
try
:
data
=
await
altrepo
.
api
.
task
.
progress
.
find_tasks
(
input
=
[
package
.
pkg_name
,
"sisyphus"
,
package
.
new_version
,
status
]
)
task_id
=
data
.
tasks
[
0
]
.
task_id
updated_in_task_message
=
(
f
" (<a href='{TASK_URL}{task_id}'>{task_id}/{status}</a>)"
)
crossed
=
True
break
except
:
crossed
=
False
continue
prefix
=
"<s>"
if
crossed
else
""
suffix
=
"</s>"
if
crossed
else
""
watch_message
+=
HTMLFormatter
(
f
"{prefix}"
f
"{package.pkg_name}: {package.old_version} -> "
f
"<a href='{package.url.replace("
.
git
/
", "
/
")}'>{package.new_version}</a>"
f
"{suffix}"
f
"{updated_in_task_message}
\n
"
f
"<a href='{package.url.replace('.git/', '/')}'>{package.new_version}</a>
\n
"
)
markup
=
None
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment