Skip to content

Commit

Permalink
changed statistics behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
sampaiodiego authored and engelgabriel committed Jan 12, 2016
1 parent 15d3e44 commit 94c9ef3
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions server/startup/cron.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@
SyncedCron.config
collectionName: 'rocketchat_cron_history'

generateStatistics = ->
statistics = RocketChat.statistics.save()
statistics.host = Meteor.absoluteUrl()
unless RocketChat.settings.get 'Statistics_opt_out'
HTTP.post 'https://rocket.chat/stats',
data: statistics
return

Meteor.startup ->
Meteor.defer ->
generateStatistics()

# Generate and save statistics every hour
SyncedCron.add
name: 'Generate and save statistics',
schedule: (parser) -># parser is a later.parse object
return parser.text 'every 1 hour'
job: ->
statistics = RocketChat.statistics.save()
statistics.host = Meteor.absoluteUrl()
unless RocketChat.settings.get 'Statistics_opt_out'
console.log 'Sending statistics data to Rocket.Chat'
HTTP.post 'https://rocket.chat/stats',
data: statistics

return
job: generateStatistics

SyncedCron.start()

0 comments on commit 94c9ef3

Please sign in to comment.