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
2f0b9707
Verified
Commit
2f0b9707
authored
2 years ago
by
Georg Krause
Browse files
Options
Downloads
Patches
Plain Diff
Fix decorator issues
parent
101969f3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
funkwhale_network/db.py
+6
-2
6 additions, 2 deletions
funkwhale_network/db.py
funkwhale_network/worker.py
+3
-0
3 additions, 0 deletions
funkwhale_network/worker.py
with
9 additions
and
2 deletions
funkwhale_network/db.py
+
6
−
2
View file @
2f0b9707
import
aiopg
import
psycopg2
from
funkwhale_network
import
settings
async
def
get_pool
(
db_dsn
):
return
await
aiopg
.
create_pool
(
db_dsn
)
...
...
@@ -67,8 +69,8 @@ TABLES = [("domains", create_domains_table), ("checks", create_checks_table)]
def
dict_cursor
(
func
):
async
def
inner
(
conn
,
*
args
,
**
kwargs
):
async
w
it
h
conn
.
cursor
(
cursor_factory
=
psycopg2
.
extras
.
RealDictCursor
)
as
cursor
:
return
await
func
(
cursor
,
*
args
,
**
kwargs
)
cursor
=
awa
it
conn
.
cursor
(
cursor_factory
=
psycopg2
.
extras
.
RealDictCursor
)
return
await
func
(
cursor
,
*
args
,
**
kwargs
)
return
inner
...
...
@@ -78,6 +80,8 @@ async def get_latest_check_by_domain(cursor):
sql
=
"""
SELECT DISTINCT on (domain) domain, * FROM checks INNER JOIN domains ON checks.domain = domains.name WHERE private = %s AND domains.blocked = false ORDER BY domain, time DESC
"""
conn
=
await
aiopg
.
connect
(
settings
.
DB_DSN
)
cursor
=
await
conn
.
cursor
(
cursor_factory
=
psycopg2
.
extras
.
RealDictCursor
)
await
cursor
.
execute
(
sql
,
[
False
])
return
list
(
await
cursor
.
fetchall
())
...
...
This diff is collapsed.
Click to expand it.
funkwhale_network/worker.py
+
3
−
0
View file @
2f0b9707
...
...
@@ -20,8 +20,11 @@ async def update_all(ctx):
for
check
in
await
db
.
get_latest_check_by_domain
(
pool
):
await
poll
(
ctx
,
check
[
"
domain
"
])
async
def
startup
(
ctx
):
ctx
[
"
session
"
]
=
ClientSession
()
class
WorkerSettings
:
on_startup
=
startup
cron_jobs
=
[
cron
(
update_all
,
minute
=
None
)]
max_concurrent_tasks
=
20
shutdown_delay
=
5
...
...
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