summaryrefslogtreecommitdiff
path: root/plugins/jobs/drivers/ephemeral
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-08-09 23:26:24 +0300
committerValery Piashchynski <[email protected]>2021-08-09 23:26:59 +0300
commitd379c28a1e9babead0266bc4fa10d6c5e7aa14cb (patch)
tree8e939b38c9ddd0d6a71f9d99a53fae067608dd0c /plugins/jobs/drivers/ephemeral
parent0f16b25156cf98357865945d1c3bd5a038853c60 (diff)
Add initial support for the php worker protocol.
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'plugins/jobs/drivers/ephemeral')
-rw-r--r--plugins/jobs/drivers/ephemeral/item.go24
1 files changed, 14 insertions, 10 deletions
diff --git a/plugins/jobs/drivers/ephemeral/item.go b/plugins/jobs/drivers/ephemeral/item.go
index 442533c5..ebf16524 100644
--- a/plugins/jobs/drivers/ephemeral/item.go
+++ b/plugins/jobs/drivers/ephemeral/item.go
@@ -69,21 +69,21 @@ func (o *Options) TimeoutDuration() time.Duration {
return time.Second * time.Duration(o.Timeout)
}
-func (j *Item) ID() string {
- return j.Ident
+func (i *Item) ID() string {
+ return i.Ident
}
-func (j *Item) Priority() int64 {
- return j.Options.Priority
+func (i *Item) Priority() int64 {
+ return i.Options.Priority
}
// Body packs job payload into binary payload.
-func (j *Item) Body() []byte {
- return utils.AsBytes(j.Payload)
+func (i *Item) Body() []byte {
+ return utils.AsBytes(i.Payload)
}
// Context packs job context (job, id) into binary payload.
-func (j *Item) Context() ([]byte, error) {
+func (i *Item) Context() ([]byte, error) {
ctx, err := json.Marshal(
struct {
ID string `json:"id"`
@@ -91,7 +91,7 @@ func (j *Item) Context() ([]byte, error) {
Headers map[string][]string `json:"headers"`
Timeout int64 `json:"timeout"`
Pipeline string `json:"pipeline"`
- }{ID: j.Ident, Job: j.Job, Headers: j.Headers, Timeout: j.Options.Timeout, Pipeline: j.Options.Pipeline},
+ }{ID: i.Ident, Job: i.Job, Headers: i.Headers, Timeout: i.Options.Timeout, Pipeline: i.Options.Pipeline},
)
if err != nil {
@@ -101,12 +101,16 @@ func (j *Item) Context() ([]byte, error) {
return ctx, nil
}
-func (j *Item) Ack() error {
+func (i *Item) Ack() error {
// noop for the in-memory
return nil
}
-func (j *Item) Nack() error {
+func (i *Item) Nack() error {
// noop for the in-memory
return nil
}
+
+func (i *Item) Requeue(_ uint32) error {
+ return nil
+}