mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-07 16:19:02 +02:00
wip: use new metrics.timeAsyncMethod
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
mongojs = require("../../infrastructure/mongojs")
|
||||
metrics = require("../../infrastructure/Metrics")
|
||||
db = mongojs.db
|
||||
ObjectId = mongojs.ObjectId
|
||||
async = require "async"
|
||||
@@ -57,3 +58,6 @@ module.exports = ProjectGetter =
|
||||
CollaboratorsHandler.getProjectsUserIsCollaboratorOf user_id, fields, (error, readAndWriteProjects, readOnlyProjects) ->
|
||||
return callback(error) if error?
|
||||
callback null, projects, readAndWriteProjects, readOnlyProjects
|
||||
|
||||
|
||||
metrics.timeAsyncMethod ProjectGetter, 'getProject', 'ProjectGetter.getProject', logger
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
mongojs = require("../../infrastructure/mongojs")
|
||||
metrics = require('../../infrastructure/Metrics')
|
||||
logger = require('logger-sharelatex')
|
||||
db = mongojs.db
|
||||
ObjectId = mongojs.ObjectId
|
||||
|
||||
@@ -23,4 +25,7 @@ module.exports = UserGetter =
|
||||
catch error
|
||||
return callback error
|
||||
|
||||
db.users.find { _id: { $in: user_ids} }, projection, callback
|
||||
db.users.find { _id: { $in: user_ids} }, projection, callback
|
||||
|
||||
metrics.timeAsyncMethod UserGetter, 'getUser', 'UserGetter.getUser', logger
|
||||
metrics.timeAsyncMethod UserGetter, 'getUsers', 'UserGetter.getUsers', logger
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
mongojs = require("../../infrastructure/mongojs")
|
||||
metrics = require("../../infrastructure/Metrics")
|
||||
db = mongojs.db
|
||||
ObjectId = mongojs.ObjectId
|
||||
logger = require('logger-sharelatex')
|
||||
|
||||
module.exports =
|
||||
module.exports = UserLocator =
|
||||
|
||||
findByEmail: (email, callback)->
|
||||
email = email.trim()
|
||||
@@ -10,4 +12,7 @@ module.exports =
|
||||
callback(err, user)
|
||||
|
||||
findById: (_id, callback)->
|
||||
db.users.findOne _id:ObjectId(_id+""), callback
|
||||
db.users.findOne _id:ObjectId(_id+""), callback
|
||||
|
||||
metrics.timeAsyncMethod UserLocator, 'findById', 'UserLocator.findById', logger
|
||||
metrics.timeAsyncMethod UserLocator, 'findByEmail', 'UserLocator.findByEmail', logger
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
logger = require("logger-sharelatex")
|
||||
mongojs = require("../../infrastructure/mongojs")
|
||||
metrics = require("../../infrastructure/Metrics")
|
||||
db = mongojs.db
|
||||
ObjectId = mongojs.ObjectId
|
||||
UserLocator = require("./UserLocator")
|
||||
@@ -28,3 +29,5 @@ module.exports = UserUpdater =
|
||||
return callback(err)
|
||||
callback()
|
||||
|
||||
|
||||
metrics.timeAsyncMethod UserUpdater, 'updateUser', 'UserUpdater.updateUser', logger
|
||||
|
||||
@@ -39,8 +39,6 @@ ErrorController = require "../Features/Errors/ErrorController"
|
||||
UserSessionsManager = require "../Features/User/UserSessionsManager"
|
||||
AuthenticationController = require "../Features/Authentication/AuthenticationController"
|
||||
|
||||
metrics.mongodb.monitor(Path.resolve(__dirname + "/../../../node_modules/mongojs/node_modules/mongodb"), logger)
|
||||
metrics.mongodb.monitor(Path.resolve(__dirname + "/../../../node_modules/mongoose/node_modules/mongodb"), logger)
|
||||
|
||||
metrics.event_loop?.monitor(logger)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user