Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mikepaszkiewicz
Last active July 20, 2017 15:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikepaszkiewicz/e118d90d751ade830d8aaf5e80e8b4dc to your computer and use it in GitHub Desktop.
Save mikepaszkiewicz/e118d90d751ade830d8aaf5e80e8b4dc to your computer and use it in GitHub Desktop.
Staffjoy cron bug
Staffjoy Suite Cron Docs: https://github.com/mikepaszkiewicz/staffing.tryhabitat.com#required-and-optional-services
curl --user API_KEY: http://staffing.tryhabitat.com/api/v2/internal/cron/
Server Error on cron run:
ERROR Exception on /api/v2/organizations/1/locations/2/roles/3/users/182
[GET] Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1473, in full_dispatch_request rv = self.preprocess_request()
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1666, in preprocess_request rv = func()
File "./app/apiv2/routes.py", line 152, in authenticate api_key_user = ApiKey.get_user(token)
File "./app/models/api_key_model.py", line 60, in get_user apikey = ApiKey.query.get(data.get("id"))
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 831, in get
return self._get_impl(ident, loading.load_on_ident) F
ile "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 864, in _get_impl r
eturn fallback_fn(self, key)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/loading.py", line 219, in load_on_ident
return q.one()
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 2693, in one
ret = list(self)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 2736, in __iter__ return self._execute_and_instances(context)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 2749, in _execute_and_instances close_with_result=True)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 2740, in _connection_from_session **kw)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 893, in connection execution_options=execution_options)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 898, in _connection_for_bind engine, execution_options)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 313, in _connection_for_bind self._assert_active()
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 214, in _assert_active % self._rollback_exception
InvalidRequestError: This Session's transaction has been rolled back due to a previous exception during flush.
To begin a new transaction with this Session, first issue Session.rollback().
Original exception was: (raised as a result of Query-invoked autoflush; consider using a session.no_autoflush block if this flush is occurring prematurely)
(_mysql_exceptions.OperationalError) (1205, 'Lock wait timeout exceeded; try restarting transaction')
[SQL: u'UPDATE apikeys SET last_used=%s WHERE apikeys.id = %s'] [parameters: (datetime.datetime(2017, 7, 20, 1, 5, 43, 394650), 6L)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment