mirror of
https://github.com/veekun/pokedex.git
synced 2024-08-20 18:16:34 +00:00
When loading Pokédex data, commit every 1000 rows.
Mostly done to fix RAM usage issues, but seems to have increased speed slightly.
This commit is contained in:
parent
5deb9b2d16
commit
149b34b888
1 changed files with 5 additions and 0 deletions
|
@ -175,6 +175,11 @@ def load(session, directory=None, drop_tables=False, verbose=False):
|
|||
|
||||
session.add(row)
|
||||
|
||||
# Remembering some zillion rows in the session consumes a lot of
|
||||
# RAM. Let's not do that. Commit every 1000 rows
|
||||
if len(session.new) > 1000:
|
||||
session.commit()
|
||||
|
||||
session.commit()
|
||||
|
||||
# Attempt to add any spare rows we've collected
|
||||
|
|
Loading…
Reference in a new issue