mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
cleanup of previous server crashing workaround, i think i figured it out
This commit is contained in:
@@ -40,7 +40,7 @@ module.exports = function(expressApp, root, derby) {
|
|||||||
return res.send(500, err);
|
return res.send(500, err);
|
||||||
}
|
}
|
||||||
userObj = user.get();
|
userObj = user.get();
|
||||||
if (!(userObj && userObj.stats && userObj.stats.money && !_.isEmpty(userObj.tasks))) {
|
if (!(userObj && !_.isEmpty(userObj.stats))) {
|
||||||
console.log({
|
console.log({
|
||||||
taskId: taskId,
|
taskId: taskId,
|
||||||
direction: direction,
|
direction: direction,
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ module.exports = (expressApp, root, derby) ->
|
|||||||
model.fetch "users.#{uid}", (err, user) ->
|
model.fetch "users.#{uid}", (err, user) ->
|
||||||
return res.send(500, err) if err
|
return res.send(500, err) if err
|
||||||
userObj = user.get()
|
userObj = user.get()
|
||||||
#FIXME The server keeps crashing. I think it's because some users are entering non-guids as their userId, test that here
|
# Server crashes without this, I think some users are entering non-guid userIds and/or trying to use the API without having an account
|
||||||
unless userObj && userObj.stats && userObj.stats.money && !_.isEmpty(userObj.tasks)
|
unless userObj && !_.isEmpty(userObj.stats)
|
||||||
console.log {taskId:taskId, direction:direction, user:userObj, error: 'non-user attempted to score'}
|
console.log {taskId:taskId, direction:direction, user:userObj, error: 'non-user attempted to score'}
|
||||||
return res.send(500, "User #{uid} not found")
|
return res.send(500, "User #{uid} not found")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user