ptpb / pb

pb is a formerly-lightweight pastebin and url shortener
Other
549 stars 52 forks source link

excessive database queries #141

Open buhman opened 8 years ago

buhman commented 8 years ago

There's some patterns like this:

cur = model.get_digest(stream)
if cur.count():
    return 'already exists'
else:
    model.insert(stream)

Digest is indexed, so catching DuplicateKeyError is sufficient. No idea who wrote this shit.