lib/publisher.js
function _bucketInit() {
            morayClient.getBucket(self.morayBucket.name, function _gb(err) {
                if (isBucketNotFoundError(err)) {
                    var name = self.morayBucket.name;
                    var config = self.morayBucket.config;
                    morayClient.createBucket(name, config, function _cb(err2) {
                        log.info({ n: name, c: config }, 'cf: creating bucket');
                        if (err2) {
                            log.error({ cErr: err2 }, 'cf: Bucket not created');
                            expBackoff.backoff();
                        } else {
                            log.info('cf: Bucket successfully setup');
                            self.emit('moray-ready');
                            expBackoff.reset();
                        }
                    });
                } else if (err) {
                    log.error({ cErr: err }, 'cf: Bucket was not loaded');
                    expBackoff.backoff();
                } else {
                    log.info('cf: Bucket successfully setup');
                    self.emit('moray-ready');
                    expBackoff.reset();
                }
            });
        }
function _bucketInit() {
            morayClient.getBucket(self.morayBucket.name, function _gb(err) {
                if (isBucketNotFoundError(err)) {
                    var name = self.morayBucket.name;
                    var config = self.morayBucket.config;
                    morayClient.createBucket(name, config, function _cb(err2) {
                        log.info({ n: name, c: config }, 'cf: creating bucket');
                        if (err2) {
                            log.error({ cErr: err2 }, 'cf: Bucket not created');
                            expBackoff.backoff();
                        } else {
                            log.info('cf: Bucket successfully setup');
                            self.emit('moray-ready');
                            expBackoff.reset();
                        }
                    });
                } else if (err) {
                    log.error({ cErr: err }, 'cf: Bucket was not loaded');
                    expBackoff.backoff();
                } else {
                    log.info('cf: Bucket successfully setup');
                    self.emit('moray-ready');
                    expBackoff.reset();
                }
            });
        }
function _bucketInit ( ) { morayClient . getBucket ( self . morayBucket . name , function _gb ( err ) { if ( isBucketNotFoundError ( err ) ) { var name = self . morayBucket . name ; var config = self . morayBucket . config ; morayClient . createBucket ( name , config , function _cb ( err2 ) { log . info ( { n : name , c : config } , 'cf: creating bucket' ) ; if ( err2 ) { log . error ( { cErr : err2 } , 'cf: Bucket not created' ) ; expBackoff . backoff ( ) ; } else { log . info ( 'cf: Bucket successfully setup' ) ; self . emit ( 'moray-ready' ) ; expBackoff . reset ( ) ; } } ) ; } else if ( err ) { log . error ( { cErr : err } , 'cf: Bucket was not loaded' ) ; expBackoff . backoff ( ) ; } else { log . info ( 'cf: Bucket successfully setup' ) ; self . emit ( 'moray-ready' ) ; expBackoff . reset ( ) ; } } ) ; }
Handles bucket initilization and backoff on failure
Handles bucket initilization and backoff on failure