 	Timer.cancel 'updateCompletion', {}
 	Db.shared.set('latestUpdate', new Date()/1000)
 	Db.shared.set 'updating', 'false'
+	Db.backend.remove 'pluginInfoCopy'
 	recalculateStatistics()
 
 # A callback result from a Conquest plugin after asked for database

	return 0

# Client call to update databases
exports.client_gatherHistory = ->
	Timer.cancel 'gatheringTimeout', {}
	Timer.cancel 'updateCompletion', {}
	Db.shared.set 'doneCount', 0
	Db.shared.set 'lastDoneCount', 0
	Db.shared.set 'updating', 'true'
	log '[gatherHistory()] Starting to request'
	Db.backend.iterate 'pluginInfo' , (group) !->
		Db.backend.set 'pluginInfo', group.key(), 'upToDate', 'false'
		if Db.backend.peek('pluginInfo', group.key(), 'active') is 'true'
			log '  Requesting from: '+group.key()
			Http.post 
				url: 'https://happening.im/x/' + group.key()
				data: '64foNwpEfn3LQrTQC2q5NijPqG92Nv2xYi65gFz6uTJjPJS2stN7MbyNygtvKvNS'
				name: 'historyResult'
	log '[gatherHistory()] Done sending requests'
	Timer.set Config.gatheringTimeout, 'gatheringTimeout', {}
	Timer.set Config.updateCompletionDelay, 'updateCompletion', {}
	return 0

# Client call for updating statistics
exports.client_updateStatistics = ->

Config = {
		updateCompletionDelay: 500				# milliseconds between updating the doneCount for the client while gathering data
		gatheringTimeout: 120*1000				# timeout of the gathering (time after receiving last result) non-updated plugins will be marked as inactive after this
		gatherRequestsPerSecond: 10				# how many HTTP data gather requests will be send each second
	}

# Upgrade of the plugin
