Skip to content

Commit

Permalink
rename updateTask to cloneTask
Browse files Browse the repository at this point in the history
  • Loading branch information
faceair committed Jun 18, 2018
1 parent 9769a0f commit c07c2ee
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

<p align="center">
<a href="https://raw.githubusercontent.com/faceair/gotit/master/LICENSE"><img src="https://img.shields.io/hexpm/l/plug.svg" alt="License"></a>
<a href="https://travis-ci.org/faceair/gotit"><img src="https://img.shields.io/travis/faceair/gotit/master.svg?t=1529303885" alt="Travis branch"></a>
<a href="https://coveralls.io/github/faceair/gotit?branch=master"><img src="https://coveralls.io/repos/github/faceair/gotit/badge.svg?branch=master&t=1529303885" alt="Coverage Status"></a>
<a href="https://goreportcard.com/report/github.com/faceair/gotit"><img src="https://goreportcard.com/badge/github.com/faceair/gotit?t=1529303885" alt="Go Report Card"></a>
<a href="https://travis-ci.org/faceair/gotit"><img src="https://img.shields.io/travis/faceair/gotit/master.svg?t=1529307051" alt="Travis branch"></a>
<a href="https://coveralls.io/github/faceair/gotit?branch=master"><img src="https://coveralls.io/repos/github/faceair/gotit/badge.svg?branch=master&t=1529307051" alt="Coverage Status"></a>
<a href="https://goreportcard.com/report/github.com/faceair/gotit"><img src="https://goreportcard.com/badge/github.com/faceair/gotit?t=1529307051" alt="Go Report Card"></a>
<a href="https://godoc.org/github.com/faceair/gotit"><img src="https://godoc.org/github.com/faceair/gotit?status.svg" alt="GoDoc"></a>
</p>

Expand Down
16 changes: 8 additions & 8 deletions git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func NewServer(gopath string) *Server {

g := &Server{
gopath: gopath,
queue: make(chan *updateTask, 1024),
queue: make(chan *cloneTask, 1024),
}
go g.cloneLoop()
return g
Expand All @@ -36,7 +36,7 @@ func NewServer(gopath string) *Server {
// Server implement interface of betproxy.Client
type Server struct {
gopath string
queue chan *updateTask
queue chan *cloneTask
upTime sync.Map
}

Expand All @@ -62,12 +62,12 @@ func (g *Server) Do(req *http.Request) (*http.Response, error) {

case "/info/refs":
if !g.checkRepo(repoPath) {
task := newUpdateTask(repoPath)
task := newCloneTask(repoPath)
g.queue <- task
<-task.Done()
} else {
select {
case g.queue <- newUpdateTask(repoPath):
case g.queue <- newCloneTask(repoPath):
default:
}
}
Expand Down Expand Up @@ -207,18 +207,18 @@ func (l *LogBuffer) String() string {
return string(l.buffer)
}

func newUpdateTask(repoPath string) *updateTask {
return &updateTask{
func newCloneTask(repoPath string) *cloneTask {
return &cloneTask{
repoPath: repoPath,
done: make(chan struct{}),
}
}

type updateTask struct {
type cloneTask struct {
repoPath string
done chan struct{}
}

func (t *updateTask) Done() chan struct{} {
func (t *cloneTask) Done() chan struct{} {
return t.done
}

0 comments on commit c07c2ee

Please sign in to comment.