github.com/cozy/cozy-stack@v0.0.0-20240603063001-31110fa4cae1/model/job/rate_limiting.go (about) 1 package job 2 3 import ( 4 "errors" 5 6 "github.com/cozy/cozy-stack/pkg/limits" 7 ) 8 9 // GetCounterTypeFromWorkerType returns the CounterTypeFromWorkerType 10 func GetCounterTypeFromWorkerType(workerType string) (limits.CounterType, error) { 11 switch workerType { 12 case "thumbnail": 13 return limits.JobThumbnailType, nil 14 case "share-track": 15 return limits.JobShareTrackType, nil 16 case "share-replicate": 17 return limits.JobShareReplicateType, nil 18 case "share-upload": 19 return limits.JobShareUploadType, nil 20 case "konnector": 21 return limits.JobKonnectorType, nil 22 case "zip": 23 return limits.JobZipType, nil 24 case "sendmail": 25 return limits.JobSendMailType, nil 26 case "service": 27 return limits.JobServiceType, nil 28 case "push": 29 return limits.JobNotificationType, nil 30 case "notes-persist": 31 return limits.JobNotesPersistType, nil 32 case "client": 33 return limits.JobClientType, nil 34 default: 35 return -1, errors.New("CounterType was not found") 36 } 37 }