Skip to content
  • Georges Racinet's avatar
    RefService.ListRefs: implement sort options · 5e471db01039
    Georges Racinet authored
    The Python implementation is straightforward. Of course, we have
    to conflate the three possible dates, and even use those of the
    target changeset, as we don't have creation dates for references
    (we could in the case of tags in some far future).
    
    In the Rust implementation, the key point is how to start with an ordinary
    async `spawn` and then use a separate thread (`spawn_blocking`) to
    open the changelog if needed.
    
    It turns out that doing this from the first spawned task is impossible
    (it claims that `spawn_blocking` or its avatar as `load_repo_and_then` is
    not `Send` as soon as we want to pass the vector to sort).
    So instead, we pipe a second channel if needed. It sounds a bit silly
    to chunk, reaggregate, and then rechunk after sorting, but it does not
    matter much in the grand scheme of things.
    
    Also attempts to move this new spawning to `rhgitaly::repository` were
    unconclusive: in the current state of things, it would force to preclone
    the entire request, which is probably not a big concern, but still
    unsatisfactory, given that we only need the sort options (in this case,
    but not in a generic version). This is all complicated by the error about
    not being `Send` that gets displayed systematically if there are other
    errors (does not help knowing whether it will be true at the end when
    experimenting). We'll leaving it as is for now, and wait to have more
    use cases to try and do better.
    5e471db01039