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