basho / giddyup

Visual scorecard for riak_test.
http://giddyup.basho.com/
54 stars 12 forks source link

Server Sent Events #31

Closed cmeiklejohn closed 11 years ago

cmeiklejohn commented 11 years ago

@seancribbs

Still need to make redis a variable, and add the add-on.

seancribbs commented 11 years ago

Added RedisToGo, I'll hack the bootstrap and test.

seancribbs commented 11 years ago

So what is required in the browser to make this work? I ran a riak_test suite locally, and saw no updates in the UI at all.

seancribbs commented 11 years ago

Ok, I think I figured it out: somehow the incoming test results aren't being posted to the Redis channel. I can mimic what it does easily in the console and see that Redis works and I get results from a curl CLI connected to the live stream.

# for example
GiddyUp::REDIS.publish("test_results", JSON.generate({:id => 3001, :data => {:foo => "bar"}}))
$ curl -i --raw http://localhost:5000/live
HTTP/1.1 200 OK
Connection: keep-alive
Cache-Control: no-cache
Content-Type: text/event-stream
Transfer-Encoding: chunked
Server: Webmachine-Ruby/1.0.0 Rack/1.1

31
id: 3001
event: test_result
data: {"foo":"bar"}
cmeiklejohn commented 11 years ago

Wait, what's that extra 31 in the response?

cmeiklejohn commented 11 years ago

Oh! I bet your request is failing. I discovered today that the rescue in create_test_result rescues exceptions and still returns 201. We need to fix that to return an error code.

cmeiklejohn commented 11 years ago

@seancribbs pushed fix to halt with 500 on error.

cmeiklejohn commented 11 years ago

Closing.