Permalink
Browse files

minor fix for concurrent checkin update

  • Loading branch information...
1 parent a366382 commit 7929a4919cb1d4dde910a413602ebb90da545de0 @rosolovskiy rosolovskiy committed Aug 20, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 index.py
View
@@ -136,8 +136,8 @@ def api_checkin(sitehash):
checkin = get_default_checkin(sitehash)
mongo.db.kitty.insert(checkin)
else:
- checkin['checkins'] = int(checkin['checkins']) + 1
- mongo.db.kitty.update({'sitehash': sitehash}, checkin)
+ checkin_inc = {"$inc": {"checkins": 1}}
+ mongo.db.kitty.update({'sitehash': sitehash}, checkin_inc)
checkin['error'] = 0
checkin["comments_url"] = '/api/v1/comments/' + sitehash
if checkin.has_key("comments"):

0 comments on commit 7929a49

Please sign in to comment.