Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
network
Manage
Activity
Members
Labels
Plan
Issues
4
Issue boards
Milestones
Wiki
Code
Merge requests
9
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
funkwhale
network
Commits
0a370722
Verified
Commit
0a370722
authored
2 years ago
by
Georg Krause
Browse files
Options
Downloads
Patches
Plain Diff
Make sure all known domains are updated
parent
fbd5ed8c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#26537
passed with stages
Stage: lint
Stage: test
Stage: build
in 7 minutes and 33 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
funkwhale_network/db.py
+8
-0
8 additions, 0 deletions
funkwhale_network/db.py
funkwhale_network/worker.py
+5
-2
5 additions, 2 deletions
funkwhale_network/worker.py
with
13 additions
and
2 deletions
funkwhale_network/db.py
+
8
−
0
View file @
0a370722
...
...
@@ -144,6 +144,14 @@ class DB:
base_query
=
"
SELECT DISTINCT on (domain) domain, * FROM checks INNER JOIN domains ON checks.domain = domains.name WHERE domains.blocked = false ORDER BY domain, time DESC
"
return
base_query
.
format
(
where_clause
=
""
),
[]
async
def
get_all_domains
(
self
):
with
(
await
self
.
pool
.
cursor
(
cursor_factory
=
psycopg2
.
extras
.
RealDictCursor
)
)
as
cursor
:
await
cursor
.
execute
(
"
SELECT name FROM domains
"
)
domains
=
list
(
await
cursor
.
fetchall
())
return
domains
async
def
get_domains
(
self
,
**
kwargs
):
with
(
await
self
.
pool
.
cursor
(
cursor_factory
=
psycopg2
.
extras
.
RealDictCursor
)
...
...
This diff is collapsed.
Click to expand it.
funkwhale_network/worker.py
+
5
−
2
View file @
0a370722
...
...
@@ -12,9 +12,12 @@ async def poll(ctx, domain):
async
def
update_all
(
ctx
):
async
with
DB
()
as
db
:
domains
=
await
db
.
get_latest_check_by_domain
()
domains
=
await
db
.
get_all_domains
()
print
(
domains
)
for
check
in
domains
:
await
poll
(
ctx
,
check
[
"
domain
"
])
domain
=
check
[
"
name
"
]
print
(
f
"
Checking domain
{
domain
}
"
)
await
poll
(
ctx
,
domain
)
async
def
startup
(
ctx
):
...
...
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