import Clients from '../../collections/clients.js';
import { check } from 'meteor/check';

import { Logger } from 'meteor/ostrio:logger';
import { LoggerFile } from 'meteor/ostrio:loggerfile';

var log = new Logger();
(new LoggerFile(log)).enable();
Meteor.publish("clients", function() {

    // if (!this.userId) {
    //     return this.ready();
    // }
    // return Clients.find({});

    if (this.userId) {
        Meteor.settings.enableDebug ? log.debug(`clientsPublisher => start publish clients `, {}, Meteor.user().username) : '';
        return Clients.find({}, {

            disableOplog: true,
            // pollingThrottleMs: 1000,
            pollingIntervalMs: 1000
        })
    } else {
        return [];
    }

});