Skip to content
This repository has been archived by the owner on Mar 7, 2018. It is now read-only.

Add route to persist history.yml on demand #268

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

andyhayes
Copy link

Workaround for issue #244 (history.yml file not being written when server not shut down cleanly) but probably useful in other scenarios too.

Adds post /system/persist-history route to persist the history.yml file to disk on demand. As with other routes, it requires a json body with valid auth_token.

Not 100% sure on the route path, so happy to change if anyone has a better suggestion.

@jbfarez
Copy link

jbfarez commented Nov 28, 2013

This sounds really really really GREAT !

@j1n6
Copy link

j1n6 commented Jun 27, 2014

This sounds like a great idea, I will add this API to dashing-contrib

@terraboops
Copy link
Contributor

This is a cool idea, though it might be nicer to simply persist the history whenever send_event is triggered -- debounced so that it is only written once every minute or so. Somewhere in here maybe:

dashing/lib/dashing/app.rb

Lines 133 to 139 in 439182f

def send_event(id, body, target=nil)
body[:id] = id
body[:updatedAt] ||= Time.now.to_i
event = format_event(body.to_json, target)
Sinatra::Application.settings.history[id] = event unless target == 'dashboards'
Sinatra::Application.settings.connections.each { |out| out << event }
end

This depends on how expensive it is to write the history to disk...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants