     process.env.INDEXES_PATH ?= path.join persistentDirectory, 'indexes'
 
 indexer = require 'cozy-indexer'
-db = require('../helpers/db_connect_helper').db_connect()
 async = require 'async'
-locker = require '../lib/locker'
 log =  require('printit')
     date: true
     prefix: 'indexer'
+
+locker = require '../lib/locker'
+db = require('../helpers/db_connect_helper').db_connect()
 
 indexQueue = {}
 batchInProgress = false

path = require 'path'
# set env for cozy-indexer
# if we have APPLICATION_PERSISTENT_DIRECTORY, we have the new controller
# and we use the provided directory

        setTimeout tryAgain, 100
    else
        callback null

