@@ -351,27 +351,29 @@ func NewTextile(ctx context.Context, conf Config, opts ...Option) (*Textile, err
351351 }
352352
353353 jobFinalizedEvents := make (chan archive.JobEvent )
354- t .archiveTracker , err = tracker .New (
355- t .collections ,
356- t .bucks ,
357- t .pc ,
358- t .internalHubSession ,
359- conf .ArchiveJobPollIntervalSlow ,
360- conf .ArchiveJobPollIntervalFast ,
361- jobFinalizedEvents ,
362- )
363- if err != nil {
364- return nil , err
365- }
366354
367- filRetrievalDS := kt .WrapTxnDatastore (t .ts , ktipfs.PrefixTransform {
368- Prefix : datastore .NewKey ("buckets/filretrieval" ),
369- })
370- t .filRetrieval , err = retrieval .NewFilRetrieval (filRetrievalDS , t .pc , t .archiveTracker , jobFinalizedEvents , t .internalHubSession )
371- if err != nil {
372- return nil , err
373- }
355+ if t .pc != nil {
356+ t .archiveTracker , err = tracker .New (
357+ t .collections ,
358+ t .bucks ,
359+ t .pc ,
360+ t .internalHubSession ,
361+ conf .ArchiveJobPollIntervalSlow ,
362+ conf .ArchiveJobPollIntervalFast ,
363+ jobFinalizedEvents ,
364+ )
365+ if err != nil {
366+ return nil , err
367+ }
374368
369+ filRetrievalDS := kt .WrapTxnDatastore (t .ts , ktipfs.PrefixTransform {
370+ Prefix : datastore .NewKey ("buckets/filretrieval" ),
371+ })
372+ t .filRetrieval , err = retrieval .NewFilRetrieval (filRetrievalDS , t .pc , t .archiveTracker , jobFinalizedEvents , t .internalHubSession )
373+ if err != nil {
374+ return nil , err
375+ }
376+ }
375377 var hs * hubd.Service
376378 var us * usersd.Service
377379 if conf .Hub {
@@ -429,10 +431,12 @@ func NewTextile(ctx context.Context, conf Config, opts ...Option) (*Textile, err
429431 FilRetrieval : t .filRetrieval ,
430432 }
431433
432- // We can avoid the chicken-egg-problem of below line in the future.
433- // For more info, see "TODO(**)" in buckd/service.go
434- t .filRetrieval .SetBucketCreator (bs )
435- t .filRetrieval .RunDaemon ()
434+ if t .filRetrieval != nil {
435+ // We can avoid the chicken-egg-problem of below line in the future.
436+ // For more info, see "TODO(**)" in buckd/service.go
437+ t .filRetrieval .SetBucketCreator (bs )
438+ t .filRetrieval .RunDaemon ()
439+ }
436440
437441 // Start serving
438442 ptarget , err := tutil .TCPAddrFromMultiAddr (conf .AddrAPIProxy )
@@ -607,11 +611,13 @@ func (t *Textile) Close() error {
607611 }
608612 log .Info ("gRPC was shutdown" )
609613
610- log .Info ("closing fil-retrieval module" )
611- if err := t .filRetrieval .Close (); err != nil {
612- log .Errorf ("closing fil-retrieval module: %s" , err )
613- } else {
614- log .Info ("fil-retrieval was shutdown" )
614+ if t .filRetrieval != nil {
615+ log .Info ("closing fil-retrieval module" )
616+ if err := t .filRetrieval .Close (); err != nil {
617+ log .Errorf ("closing fil-retrieval module: %s" , err )
618+ } else {
619+ log .Info ("fil-retrieval was shutdown" )
620+ }
615621 }
616622
617623 if err := t .th .Close (); err != nil {
0 commit comments