INNER CODE UNIT · Python

exponent

BlessedRebuS/Krawl · src/database/core.py:52

    exponent = min(max(total_violations - 1, 0), MAX_BAN_EXPONENT)
    return 2**exponent


# ── Access-log write buffer (scalable mode) ──────────────────────────
# Instead of INSERT-per-request over the network, access log entries are
# buffered in memory and flushed in bulk every few seconds by a background task.
# IP stats counters are still updated synchronously (needed for ban checks).

# Statement size, not a per-flush ceiling: the flush loops until drained.
_FLUSH_BATCH_SIZE = 200

# Two ceilings, because a row count is not a memory bound. Entries carry
# `raw_request`, capped at MAX_RAW_REQUEST (16 KiB), so 50k rows is anywhere
# between ~60 MiB and ~800 MiB depending on what the traffic looks like — and
# an attack flood is exactly the traffic that fills the buffer with large
# entries. The byte budget is what actually holds RSS down; the row cap stays
# as a cheap second guard.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…