Skip to content

Commit

Permalink
Limit total logs imported at once
Browse files Browse the repository at this point in the history
Postgres really dislikes when you try and import too many logs at once
(thus grabbing too many logs). In addition to our minute-long commit
interval, also limit ourselves to 500 commits. With 256 locks per
transaction, I made it to 850 logs or so until I got kicked out, so 500
should be well within limits.

Signed-off-by: Sean Anderson <[email protected]>
  • Loading branch information
Forty-Bot committed Aug 27, 2021
1 parent 0dc612c commit c00bc3f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion import.py
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ def commit():
count += 1

now = datetime.now()
if (now - start).total_seconds() > 60:
if (now - start).total_seconds() > 60 or count > 500:
commit()
logging.info("Committed %s imported log(s)...", count)
cur.execute("BEGIN;")
Expand Down

0 comments on commit c00bc3f

Please sign in to comment.