Closed seanriordan08 closed 6 years ago
Hi Sean, thanks for submitting an issue. Have you tried running the query from IRB? Is it the initial results it sends out of order?
Yes, only the initial results are out of order. They are ordered correctly however, when running in IRB.
irb
require 'rethinkdb'
include RethinkDB::Shortcuts
conn = r.connect(:host=>"localhost", :port=>28015, :db=>"spectrics_development").repl
cursor = r.table("ci_builds").order_by('build_num').run(conn)
^ this works great - transmits in expected order
In my app though, i'm watching the logs when refreshing the page, and the records streamed via nobrainer_stream_from CiBuild.order_by("build_num"), include_initial: true
are initially out of order.
Thanks for looking into this!
Solved - Not a Bug
Digging deeper into the docs, I was able to get initial streamed results in-order by using a limit combined with the include_offsets
option.
What I had (Wrong)
def subscribed
nobrainer_stream_from CiBuild.order_by(:build_num), include_initial: true
end
Now (Correct)
def subscribed
nobrainer_stream_from CiBuild.order_by(:build_num).limit(20), include_initial: true, include_offsets: true
end
Thanks for letting me know!
I'm using this for an app that adds extra layers of insight to my circleci builds. Right now, i'm just tracking the runtime.
I hope i'm just doing it wrong -
I have a simple rails app that receives data from circleci for the use of custom CI metric reporting. I can't seem to get the initial data sent in-order though. I've indexed my table, and the rql looks right. I've ensured the database has been sync'd and is up-to-date with the new index.
When I run
r.table("ci_builds").order_by({"index" => r.asc(:build_num)})
in the rethinkdb repl, it spits out my data perfectly in order. e.gBut when I run the application and view the logs, the data is transmitted out of order!
At this point, what am I missing?
Thank you!