func (s *Server) handleEnqueue(w http.ResponseWriter, r *http.Request) (err error) {
	defer derrors.Wrap(&err, "handleEnqueue(%q)", r.URL.Path)
	ctx := r.Context()
	limit := parseLimitParam(r, 10)
	suffixParam := r.FormValue("suffix") // append to task name to avoid deduplication
	span := trace.FromContext(r.Context())
	span.Annotate([]trace.Attribute{trace.Int64Attribute("limit", int64(limit))}, "processed limit")
	versions, err := s.db.GetNextModulesToFetch(ctx, limit)
	if err != nil {
		return err
	}

	span.Annotate([]trace.Attribute{trace.Int64Attribute("versions to fetch", int64(len(versions)))}, "processed limit")
	w.Header().Set("Content-Type", "text/plain")
	log.Infof(ctx, "Scheduling modules to be fetched: queuing %d modules", len(versions))
	for _, v := range versions {
		if err := s.queue.ScheduleFetch(ctx, v.ModulePath, v.Version, suffixParam, s.taskIDChangeInterval); err != nil {
			return err
		}
	}
	log.Infof(ctx, "Successfully scheduled modules to be fetched: %d modules queued", len(versions))

	return nil
}
// handleEnqueue queries the module_version_states table for the next batch of
// module versions to process, and enqueues them for processing. Note that this
// may cause duplicate processing.
handleEnqueue queries the module_version_states table for the next batch of
module versions to process, and enqueues them for processing. Note that this
may cause duplicate processing.
// handleEnqueue queries the module_version_states table for the next batch of // module versions to process and enqueues them for processing . Note that this // may cause duplicate processing .
func (s *Server) handleEnqueue(w http.ResponseWriter, r *http.Request) (err error) {
	defer derrors.Wrap(&err, "handleEnqueue(%q)", r.URL.Path)
	ctx := r.Context()
	limit := parseLimitParam(r, 10)
	suffixParam := r.FormValue("suffix") 
	span := trace.FromContext(r.Context())
	span.Annotate([]trace.Attribute{trace.Int64Attribute("limit", int64(limit))}, "processed limit")
	versions, err := s.db.GetNextModulesToFetch(ctx, limit)
	if err != nil {
		return err
	}
	span.Annotate([]trace.Attribute{trace.Int64Attribute("versions to fetch", int64(len(versions)))}, "processed limit")
	w.Header().Set("Content-Type", "text/plain")
	log.Infof(ctx, "Scheduling modules to be fetched: queuing %d modules", len(versions))
	for _, v := range versions {
		if err := s.queue.ScheduleFetch(ctx, v.ModulePath, v.Version, suffixParam, s.taskIDChangeInterval); err != nil {
			return err
		}
	}
	log.Infof(ctx, "Successfully scheduled modules to be fetched: %d modules queued", len(versions))
	return nil
}
func ( s * Server ) handleEnqueue ( w http . ResponseWriter , r * http . Request ) ( err error ) { defer derrors . Wrap ( & err , " " , r . URL . Path ) ctx := r . Context ( ) limit := parseLimitParam ( r , 10 ) suffixParam := r . FormValue ( " " ) span := trace . FromContext ( r . Context ( ) ) span . Annotate ( [ ] trace . Attribute { trace . Int64Attribute ( " " , int64 ( limit ) ) } , " " ) versions , err := s . db . GetNextModulesToFetch ( ctx , limit ) if err != nil { return err } span . Annotate ( [ ] trace . Attribute { trace . Int64Attribute ( " " , int64 ( len ( versions ) ) ) } , " " ) w . Header ( ) . Set ( " " , " " ) log . Infof ( ctx , " " , len ( versions ) ) for _ , v := range versions { if err := s . queue . ScheduleFetch ( ctx , v . ModulePath , v . Version , suffixParam , s . taskIDChangeInterval ) ; err != nil { return err } } log . Infof ( ctx , " " , len ( versions ) ) return nil }
handleEnqueue queries the module_version_states table for the next batch of
module versions to process, and enqueues them for processing.
handleEnqueue queries the module_version_states table for the next batch of module versions to process and enqueues them for processing .
// append to task name to avoid deduplication