Built motion from commit e02f907f.|2.6.14
[motion2.git] / server / services / routing / server / interval.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0xa695=['rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','format','iftime\x20%s','indexOf','true','all','some','join','\x20|\x20','log','error','[%s][INTERVAL]\x20%s\x20%s','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','client','http','request','then','message','catch','condition'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa695,0x120));var _0x5a69=function(_0xff024d,_0x1ecaf8){_0xff024d=_0xff024d-0x0;var _0xaceb54=_0xa695[_0xff024d];return _0xaceb54;};'use strict';var util=require(_0x5a69('0x0'));var BPromise=require(_0x5a69('0x1'));var jayson=require(_0x5a69('0x2'));var _=require(_0x5a69('0x3'));var logger=require(_0x5a69('0x4'))('routing');var client=jayson[_0x5a69('0x5')][_0x5a69('0x6')]({'port':0x232a});function request(_0x22aebe,_0x40ba2e){return new BPromise(function(_0x1d6784,_0x1a0d37){return client[_0x5a69('0x7')](_0x22aebe,_0x40ba2e)[_0x5a69('0x8')](function(_0x57e056){if(_0x57e056['error']){return _0x1a0d37(_0x57e056['error'][_0x5a69('0x9')]);}else{return _0x1d6784(_0x57e056['result']);}})[_0x5a69('0xa')](function(_0x4ae213){return _0x1a0d37(_0x4ae213);});});}exports[_0x5a69('0xb')]=function(_0xfd2ee1,_0x6599f9,_0x4fece8){return function(_0x53e9a2){if(_0x4fece8[_0x5a69('0xc')]&&!_0x4fece8[_0x5a69('0xc')][_0xfd2ee1]){logger[_0x5a69('0xd')](_0x5a69('0xe'),_0xfd2ee1);return _0x53e9a2[_0x5a69('0xf')]();}var _0x76f663=[];for(var _0x57a884=0x0;_0x57a884<_0x6599f9['length'];_0x57a884+=0x1){_0x76f663[_0x5a69('0x10')](request(_0x5a69('0x11'),{'command':util[_0x5a69('0x12')](_0x5a69('0x13'),_0x6599f9[_0x57a884])})[_0x5a69('0x8')](function(_0x2bc7c6){return _0x2bc7c6&&_0x2bc7c6['message']&&_0x2bc7c6[_0x5a69('0x9')][_0x5a69('0x14')](_0x5a69('0x15'))>=0x0?!![]:![];})[_0x5a69('0xa')](function(_0x19abc3){logger['error']('[%s][INTERVAL]\x20%s',_0xfd2ee1,_0x6599f9[_0x57a884]);}));}BPromise[_0x5a69('0x16')](_0x76f663)[_0x5a69('0x8')](function(_0x2b85e2){var _0x532090=_[_0x5a69('0x17')](_0x2b85e2);logger[_0x5a69('0xd')]('[%s][INTERVAL]\x20%s\x20%s',_0xfd2ee1,_0x6599f9[_0x5a69('0x18')](_0x5a69('0x19')),_0x532090);_0x53e9a2['when'](_0x532090);})[_0x5a69('0xa')](function(_0x1ab980){console[_0x5a69('0x1a')](_0x1ab980);logger[_0x5a69('0x1b')](_0x5a69('0x1c'),_0xfd2ee1,_0x6599f9[_0x5a69('0x18')](_0x5a69('0x19')),_0x1ab980[_0x5a69('0x1d')]);_0x53e9a2[_0x5a69('0xf')]();});};};