- Add cancellation context

- Other bug fixes
This commit is contained in:
Mukhtar Akere
2025-05-17 21:23:43 +01:00
parent 35a74d8dba
commit 109d0a0c1c
8 changed files with 91 additions and 60 deletions

View File

@@ -18,8 +18,8 @@ var (
once sync.Once
)
func New() *Service {
once = sync.Once{}
// GetService returns the singleton instance
func GetService() *Service {
once.Do(func() {
arrs := arr.NewStorage()
deb := debrid.NewEngine()
@@ -32,23 +32,9 @@ func New() *Service {
return instance
}
// GetService returns the singleton instance
func GetService() *Service {
if instance == nil {
instance = New()
}
return instance
}
func Update() *Service {
arrs := arr.NewStorage()
deb := debrid.NewEngine()
instance = &Service{
Repair: repair.New(arrs, deb),
Arr: arrs,
Debrid: deb,
}
return instance
func Reset() {
once = sync.Once{}
instance = nil
}
func GetDebrid() *debrid.Engine {