Reverse order of logs in jobLog (fixes #192)
This merge request fixes the problem @anoe and @cgenie were having with the progress API:
The problem was triggered by the changes I have introduced as part of !137 (merged), where I have changed the data structure to hold the logs from a simple list to a Seq
. In particular, the previous implementation used the Dual
monoid in the API-facing code to append logs in a reverse order (i.e. newest first) while the internal implementation was storing them oldest to newest. as a result of this ordering change, when we were calling pollJob
with a limit=1
parameter, we were effectively always asking for the first and therefore oldest log, and this explains why we wouldn't see any changes.
This merge request fixes that by changing the order in which logs are stored inside the internal job queue data structure; while I agree that appending logs rather than cons-ing them fits more naturally with the intuition of a Haskell writer, I think that for the logs this shouldn't matter too much, and it might also be more efficient, and we could always go back to having Dual (Seq event)
if we discover this is going to be problematic down the line.
As I was at it, I have also changed ever so slightly the progress reporting in addToCorpusWithQuery
to be more streamlined.