fix expired projects command
This commit is contained in:
2
Makefile
2
Makefile
@@ -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)
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user