mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
fix expired projects command
This commit is contained in:
parent
f9754c4b95
commit
cd5bcdd7ca
5 changed files with 11 additions and 5 deletions
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
||||
|
|
|
@ -41,6 +41,8 @@ module.exports =
|
|||
]
|
||||
})
|
||||
|
||||
op: Sequelize.Op
|
||||
|
||||
sync: () ->
|
||||
logger.log dbPath:Settings.mysql.clsi.storage, "syncing db schema"
|
||||
sequelize.sync()
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
Loading…
Reference in a new issue