github / gh-classroom

GitHub Classroom CLI Extension is a powerful and easy-to-use command line tool that enhances the functionality of the GitHub CLI, specifically tailored for educators using GitHub Classroom.
MIT License
75 stars 12 forks source link

Update ListAllAcceptedAssignments to use channels #40

Closed shanep closed 9 months ago

shanep commented 10 months ago

In the ListAllAcceptedAssignments spin off each call to GetAssignmentList on its own channel. Each channel will handle one page of API data.

What are you trying to accomplish?

Making the API calls on separate channels as suggested by @zrdaley in pull request #37

What approach did you choose and why?

As was noted by @zrdaley in the discussion, spinning off each request on it's own thread can improve performance for the end user. A side effect of this change is I had to remove the unit test because as is stated in the gock documentation "gock is not fully thread-safe, but sensible parts are. Any help making gock more reliable in this sense is appreciated."

The single threaded version of ListAcceptedAssignments is still tested so it should be ok.

I have yet to find a reliable way to unit test multithread code so any suggestions would be welcome :)

What should reviewers focus on?

Any feedback on my usage of go channels and go routines is greatly appreciated.

zrdaley commented 9 months ago

This will be included in https://github.com/github/gh-classroom/releases/tag/v0.1.11