From 619e49ab044799e73534bd6a65d5171276e72357 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 17 Mar 2017 15:16:38 +0000 Subject: [PATCH] update to new api --- .../Features/Messages/MessageManager.coffee | 35 +++++-------------- .../Features/Threads/ThreadManager.coffee | 33 +++++------------ 2 files changed, 17 insertions(+), 51 deletions(-) diff --git a/services/chat/app/coffee/Features/Messages/MessageManager.coffee b/services/chat/app/coffee/Features/Messages/MessageManager.coffee index a2bdc02307..bda57097da 100644 --- a/services/chat/app/coffee/Features/Messages/MessageManager.coffee +++ b/services/chat/app/coffee/Features/Messages/MessageManager.coffee @@ -64,30 +64,13 @@ module.exports = MessageManager = if query._id? and query._id not instanceof ObjectId query._id = ObjectId(query._id) return query - -metrics.timeAsyncMethod( - MessageManager, 'createMessage', - 'MessageManager.createMessage', - logger -) -metrics.timeAsyncMethod( - MessageManager, 'getMessages', - 'MessageManager.getMessages', - logger -) -metrics.timeAsyncMethod( - MessageManager, 'findAllMessagesInRooms', - 'MessageManager.findAllMessagesInRooms', - logger -) -metrics.timeAsyncMethod( - MessageManager, 'updateMessage', - 'MessageManager.updateMessage', - logger -) -metrics.timeAsyncMethod( - MessageManager, 'deleteMessage', - 'MessageManager.deleteMessage', - logger -) + +[ + 'createMessage', + 'getMessages', + 'findAllMessagesInRooms', + 'updateMessage', + 'deleteMessage' +].map (method) -> + metrics.timeAsyncMethod(MessageManager, method, 'mongo.MessageManager', logger) diff --git a/services/chat/app/coffee/Features/Threads/ThreadManager.coffee b/services/chat/app/coffee/Features/Threads/ThreadManager.coffee index e1f6bd2ebf..d2c4b82d11 100644 --- a/services/chat/app/coffee/Features/Threads/ThreadManager.coffee +++ b/services/chat/app/coffee/Features/Threads/ThreadManager.coffee @@ -78,28 +78,11 @@ module.exports = ThreadManager = return callback null, room._id -metrics.timeAsyncMethod( - ThreadManager, 'findOrCreateThread', - 'ThreadManager.findOrCreateThread', - logger -) -metrics.timeAsyncMethod( - ThreadManager, 'findAllThreadRooms', - 'ThreadManager.findAllThreadRooms', - logger -) -metrics.timeAsyncMethod( - ThreadManager, 'resolveThread', - 'ThreadManager.resolveThread', - logger -) -metrics.timeAsyncMethod( - ThreadManager, 'reopenThread', - 'ThreadManager.reopenThread', - logger -) -metrics.timeAsyncMethod( - ThreadManager, 'deleteThread', - 'ThreadManager.deleteThread', - logger -) +[ + 'findOrCreateThread', + 'findAllThreadRooms', + 'resolveThread', + 'reopenThread', + 'deleteThread', +].map (method) -> + metrics.timeAsyncMethod(ThreadManager, method, 'mongo.ThreadManager', logger)