Skip to content

Commit

Permalink
Edited typos. Moved sweep command from under db to a standalone comma…
Browse files Browse the repository at this point in the history
…nd. In order for merging this code, I agree to assign copyright to HasGeek.
  • Loading branch information
abijith-kp committed Mar 30, 2016
1 parent 3b27c17 commit 847114a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions manage.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python

from coaster.manage import init_manager, database
from coaster.manage import init_manager, manager

import hasjob
import hasjob.models as models
Expand All @@ -11,7 +11,7 @@
from datetime import datetime, timedelta
from sqlalchemy.exc import IntegrityError

@database.option('-e', '--env', default='dev', help="runtime env [default 'dev']")
@manager.option('-e', '--env', default='dev', help="runtime env [default 'dev']")
def sweep(env):
"""Sweep the user database to close all the inactive sessions"""
manager.init_for(env)
Expand All @@ -21,7 +21,7 @@ def sweep(env):
es.query.filter((es.ended_at==None) & (es.active_at<(datetime.utcnow() - \
timedelta(minutes=30)))).update({es.ended_at: es.active_at})
try:
db.sessions.commit()
db.session.commit()
except IntegrityError:
print "Could not commit changes made. Please try again later."
db.session.rollback()
Expand Down

0 comments on commit 847114a

Please sign in to comment.