fix: need to add lifecycle hook to start tusWorker

This commit is contained in:
Derrick Hammer 2024-01-31 21:28:31 -05:00
parent d88638dfc3
commit 9a87004f31
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 11 additions and 2 deletions

View File

@ -74,14 +74,23 @@ func (s *StorageServiceDefault) Start() error {
return nil
}
func NewStorageService(params StorageServiceParams) *StorageServiceDefault {
return &StorageServiceDefault{
func NewStorageService(lc fx.Lifecycle, params StorageServiceParams) *StorageServiceDefault {
ss := &StorageServiceDefault{
config: params.Config,
logger: params.Logger,
db: params.Db,
accounts: params.Accounts,
cron: params.Cron,
}
lc.Append(fx.Hook{
OnStart: func(ctx context.Context) error {
go ss.tusWorker()
return nil
},
})
return ss
}
func (s StorageServiceDefault) PutFileSmall(file io.ReadSeeker, bucket string, generateProof bool) ([]byte, error) {