fix expired projects command

This commit is contained in:
Henry Oswald
2018-07-30 17:37:30 +01:00
parent 3a9206f1e7
commit ee518c1755
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.
# Instead run bin/update_build_scripts from
# https://github.com/sharelatex/sharelatex-dev-environment
# Version: 1.1.8
# Version: 1.1.9
BUILD_NUMBER ?= local
BRANCH_NAME ?= $(shell git rev-parse --abbrev-ref HEAD)

View File

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

View File

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

View File

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

View File

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