- Add PROPFIND for root path

- Reduce signifcantly memoery footprint
- Fix minor bugs
This commit is contained in:
Mukhtar Akere
2025-05-20 12:57:27 +01:00
parent 53748ea297
commit 5aa1c67544
36 changed files with 632 additions and 335 deletions

View File

@@ -3,13 +3,12 @@ package arr
import (
"bytes"
"context"
"encoding/json"
"fmt"
"github.com/goccy/go-json"
"github.com/rs/zerolog"
"github.com/sirrobot01/decypharr/internal/config"
"github.com/sirrobot01/decypharr/internal/logger"
"github.com/sirrobot01/decypharr/internal/request"
"github.com/sirrobot01/decypharr/internal/utils"
"io"
"net/http"
"strconv"
@@ -122,6 +121,12 @@ type Storage struct {
logger zerolog.Logger
}
func (as *Storage) Cleanup() {
as.mu.Lock()
defer as.mu.Unlock()
as.Arrs = make(map[string]*Arr)
}
func InferType(host, name string) Type {
switch {
case strings.Contains(host, "sonarr") || strings.Contains(name, "sonarr"):
@@ -183,10 +188,15 @@ func (as *Storage) Clear() {
}
func (as *Storage) StartSchedule(ctx context.Context) error {
// Schedule the cleanup job every 10 seconds
_, err := utils.ScheduleJob(ctx, "10s", nil, as.cleanupArrsQueue)
if err != nil {
return err
ticker := time.NewTicker(10 * time.Second)
select {
case <-ticker.C:
as.cleanupArrsQueue()
case <-ctx.Done():
ticker.Stop()
return nil
}
return nil
}

View File

@@ -2,8 +2,8 @@ package arr
import (
"context"
"encoding/json"
"fmt"
"github.com/goccy/go-json"
"golang.org/x/sync/errgroup"
"net/http"
"strconv"

View File

@@ -1,7 +1,7 @@
package arr
import (
"github.com/goccy/go-json"
"encoding/json"
"io"
"net/http"
gourl "net/url"

View File

@@ -1,8 +1,8 @@
package arr
import (
"encoding/json"
"fmt"
"github.com/goccy/go-json"
"io"
"net/http"
gourl "net/url"