fix expired projects command

This commit is contained in:
Henry Oswald 2018-07-30 17:37:30 +01:00
parent f9754c4b95
commit cd5bcdd7ca
5 changed files with 11 additions and 5 deletions

View file

@ -1,7 +1,7 @@
# This file was auto-generated, do not edit it directly. # This file was auto-generated, do not edit it directly.
# Instead run bin/update_build_scripts from # Instead run bin/update_build_scripts from
# https://github.com/sharelatex/sharelatex-dev-environment # https://github.com/sharelatex/sharelatex-dev-environment
# Version: 1.1.8 # Version: 1.1.9
BUILD_NUMBER ?= local BUILD_NUMBER ?= local
BRANCH_NAME ?= $(shell git rev-parse --abbrev-ref HEAD) BRANCH_NAME ?= $(shell git rev-parse --abbrev-ref HEAD)

View file

@ -68,11 +68,15 @@ module.exports = ProjectPersistenceManager =
_findExpiredProjectIds: (callback = (error, project_ids) ->) -> _findExpiredProjectIds: (callback = (error, project_ids) ->) ->
job = (cb)-> job = (cb)->
console.log("_findExpiredProjectIds") keepProjectsFrom = new Date(Date.now() - ProjectPersistenceManager.EXPIRY_TIMEOUT)
db.Project.findAll(where: ["lastAccessed < ?", new Date(Date.now() - ProjectPersistenceManager.EXPIRY_TIMEOUT)]) console.log("_findExpiredProjectIds", keepProjectsFrom)
q = {}
q[db.op.gt] = keepProjectsFrom
db.Project.findAll(where:{lastAccessed:q})
.then((projects) -> .then((projects) ->
cb null, projects.map((project) -> project.project_id) cb null, projects.map((project) -> project.project_id)
).error cb ).error cb
dbQueue.queue.push(job, callback) dbQueue.queue.push(job, callback)

View file

@ -41,6 +41,8 @@ module.exports =
] ]
}) })
op: Sequelize.Op
sync: () -> sync: () ->
logger.log dbPath:Settings.mysql.clsi.storage, "syncing db schema" logger.log dbPath:Settings.mysql.clsi.storage, "syncing db schema"
sequelize.sync() sequelize.sync()

View file

@ -1,7 +1,7 @@
# This file was auto-generated, do not edit it directly. # This file was auto-generated, do not edit it directly.
# Instead run bin/update_build_scripts from # Instead run bin/update_build_scripts from
# https://github.com/sharelatex/sharelatex-dev-environment # https://github.com/sharelatex/sharelatex-dev-environment
# Version: 1.1.8 # Version: 1.1.9
version: "2" version: "2"

View file

@ -1,7 +1,7 @@
# This file was auto-generated, do not edit it directly. # This file was auto-generated, do not edit it directly.
# Instead run bin/update_build_scripts from # Instead run bin/update_build_scripts from
# https://github.com/sharelatex/sharelatex-dev-environment # https://github.com/sharelatex/sharelatex-dev-environment
# Version: 1.1.8 # Version: 1.1.9
version: "2" version: "2"