Skip to content

Run 1 TransferQueue per uploaded ref#2806

Merged
technoweenie merged 12 commits intomasterfrom
tq-per-uploaded-ref
Jan 5, 2018
Merged

Run 1 TransferQueue per uploaded ref#2806
technoweenie merged 12 commits intomasterfrom
tq-per-uploaded-ref

Conversation

@technoweenie
Copy link
Contributor

This started as a rewrite of #2774 against new master (due to lots of conflicts with the progress meter in #2762). However, I decided to keep it scoped to just running multiple transfer queues, leaving the actual refspec-sending stuff to a follow up PR. I think that'll make this easier to review.

  • While commands.uploadContext is an internal type, I'm trying to use exported functions in commands, outside of the actual uploadContext type. Also, some functions were moved to the uploadContext type, instead of merely accepting one as an argument. There's certainly more to be done with *uploadContext, but I'd rather do that in a specific refactor PR.
  • *tq.TransferQueue now flushes the latest update, but doesn't close the Meter's internal channel. This is so there's only 1 line in the output, instead of 1 per ref. I'm open to having a single meter line per ref, but I think that should come with the upload output changes instead.
  • (*uploadContext) Await() has been broken up into CollectErrors(*tq.TransferQueue) and ReportErrors(). This is so CollectErrors() can be called after each uploaded ref.

Copy link
Contributor

@ttaylorr ttaylorr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great; I have a few minor comments, but this looks ready to go.

tq/meter.go Outdated
return
}

m.updates <- &tasklog.Update{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that one thing we could do to limit the number of places we do a channel write explicitly is to teach update() to take a force bool as a formal argument, and then pass that inside the body of the struct, like:

func (m *Meter) update(force bool) { 
        m.updates <- &tasklog.Update{Force: true, ...}
}

I don't mind the duplication, but I think that channel writes in general can be fairly nuanced, so the fewer the better.

}

q.meter.Finish()
q.meter.Flush()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that Flush() will call close(m.updates) which means that the *tasklog.Logger won't yield to future Task implementations.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EDIT: Re-reading your PR body makes this make sense to me. Is the update channel closed elsewhere, though?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@technoweenie technoweenie merged commit 5058d0f into master Jan 5, 2018
@technoweenie technoweenie deleted the tq-per-uploaded-ref branch January 5, 2018 01:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants