service.go
func (s *services) Stop(repoURL string, limit int) {
	s.Lock()
	defer s.Unlock()

	// locate repos
	for i, j := 0, 0; i < len(s.services) && ((limit >= 0 && j < limit) || limit < 0); i++ {
		service := s.services[i]
		if string(service.repo.URL) == repoURL {
			// send halt signal
			service.halt <- struct{}{}
			s.services[i] = nil
			j++
		}
	}

	// remove them from repos list
	services := s.services[:0]
	for _, s := range s.services {
		if s != nil {
			services = append(services, s)
		}
	}
	s.services = services
}
func (s *services) Stop(repoURL string, limit int) {
	s.Lock()
	defer s.Unlock()

	// locate repos
	for i, j := 0, 0; i < len(s.services) && ((limit >= 0 && j < limit) || limit < 0); i++ {
		service := s.services[i]
		if string(service.repo.URL) == repoURL {
			// send halt signal
			service.halt <- struct{}{}
			s.services[i] = nil
			j++
		}
	}

	// remove them from repos list
	services := s.services[:0]
	for _, s := range s.services {
		if s != nil {
			services = append(services, s)
		}
	}
	s.services = services
}
func ( s * services ) Stop ( repoURL string , limit int ) { s . Lock ( ) defer s . Unlock ( ) // locate repos for i , j := 0 , 0 ; i < len ( s . services ) && ( ( limit >= 0 && j < limit ) || limit < 0 ) ; i ++ { service := s . services [ i ] if string ( service . repo . URL ) == repoURL { // send halt signal service . halt <- struct { } { } s . services [ i ] = nil j ++ } } // remove them from repos list services := s . services [ : 0 ] for _ , s := range s . services { if s != nil { services = append ( services , s ) } } s . services = services }
// Stop stops at most `limit` running services pulling from git repo at
// repoURL. It waits until the service is terminated before returning.
// If limit is less than zero, it is ignored.
// TODO find better ways to identify repos
Stop stops at most limit running services pulling from git repo at repoURL . It waits until the service is terminated before returning . If limit is less than zero it is ignored . TODO find better ways to identify repos