Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
eterban
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
etersoft
eterban
Commits
4015c0d0
Commit
4015c0d0
authored
Jul 22, 2026
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gateway: update autoban state atomically
parent
2044d195
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
autoban_manager.py
gateway/usr/share/eterban/autoban_manager.py
+9
-7
No files found.
gateway/usr/share/eterban/autoban_manager.py
View file @
4015c0d0
...
...
@@ -108,20 +108,22 @@ class AutoBanManager:
'source'
:
source
,
'reason'
:
reason
}
self
.
r
.
hset
(
meta_key
,
mapping
=
metadata
)
pipeline
=
self
.
r
.
pipeline
(
transaction
=
True
)
pipeline
.
hset
(
meta_key
,
mapping
=
metadata
)
# Добавляем в расписание авто-разбана или в постоянные
if
unban_time
>
0
:
# Temporary ban history can be reset after a clean period.
self
.
r
.
expire
(
meta_key
,
self
.
reset_period_seconds
)
self
.
r
.
zadd
(
self
.
SCHEDULE_KEY
,
{
ip
:
unban_time
})
self
.
r
.
srem
(
self
.
PERMANENT_KEY
,
ip
)
# На случай если был permanent
pipeline
.
expire
(
meta_key
,
self
.
reset_period_seconds
)
pipeline
.
zadd
(
self
.
SCHEDULE_KEY
,
{
ip
:
unban_time
})
pipeline
.
srem
(
self
.
PERMANENT_KEY
,
ip
)
# На случай если был permanent
else
:
# Permanent state must not disappear when temporary metadata
# would otherwise reach its one-year TTL.
self
.
r
.
persist
(
meta_key
)
self
.
r
.
sadd
(
self
.
PERMANENT_KEY
,
ip
)
self
.
r
.
zrem
(
self
.
SCHEDULE_KEY
,
ip
)
# Убираем из расписания
pipeline
.
persist
(
meta_key
)
pipeline
.
sadd
(
self
.
PERMANENT_KEY
,
ip
)
pipeline
.
zrem
(
self
.
SCHEDULE_KEY
,
ip
)
# Убираем из расписания
pipeline
.
execute
()
return
metadata
...
...
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