feat: use queue to feed events, drop if overflowed
This commit is contained in:
parent
b0f0510e8e
commit
02580cce20
7 changed files with 198 additions and 226 deletions
|
|
@ -1,5 +1,7 @@
|
|||
package traefik_umami_feeder
|
||||
|
||||
import "context"
|
||||
|
||||
type Auth struct {
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
|
|
@ -9,9 +11,9 @@ type AuthResponse struct {
|
|||
Token string `json:"token"`
|
||||
}
|
||||
|
||||
func getToken(umamiHost string, umamiUsername string, umamiPassword string) (string, error) {
|
||||
func getToken(ctx context.Context, umamiHost string, umamiUsername string, umamiPassword string) (string, error) {
|
||||
var result AuthResponse
|
||||
err := sendRequestAndParse(umamiHost+"/api/auth/login", Auth{
|
||||
err := sendRequestAndParse(ctx, umamiHost+"/api/auth/login", Auth{
|
||||
Username: umamiUsername,
|
||||
Password: umamiPassword,
|
||||
}, nil, &result)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue