| 67 | } |
| 68 | |
| 69 | func NewAcquirer(ctx context.Context, logger slog.Logger, store AcquirerStore, ps pubsub.Pubsub, |
| 70 | opts ...AcquirerOption, |
| 71 | ) *Acquirer { |
| 72 | a := &Acquirer{ |
| 73 | ctx: ctx, |
| 74 | logger: logger, |
| 75 | store: store, |
| 76 | ps: ps, |
| 77 | q: make(map[dKey]domain), |
| 78 | backupPollDuration: backupPollDuration, |
| 79 | } |
| 80 | for _, opt := range opts { |
| 81 | opt(a) |
| 82 | } |
| 83 | a.subscribe() |
| 84 | return a |
| 85 | } |
| 86 | |
| 87 | // AcquireJob acquires a job with one of the given provisioner types and compatible |
| 88 | // tags from the database. The call blocks until a job is acquired, the context is |