feat: add jobs worker and webhook core
This commit is contained in:
1 parent
7847c95538
commit
065dcd955a
12 files changed
+1664
No files matched your search
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"version": 1,
|
||||
"statuses": ["queued", "running", "succeeded", "failed", "expired", "cancelled"],
|
||||
"terminalStatuses": ["succeeded", "failed", "expired", "cancelled"],
|
||||
"idempotency": {
|
||||
"scope": ["ownerId", "externalClientId", "idempotencyKey"],
|
||||
"body": {
|
||||
"settings": { "width": 1024, "height": 768 },
|
||||
"prompt": "hello",
|
||||
"idempotencyKey": "body-key",
|
||||
"capability": "image.generate"
|
||||
},
|
||||
"fingerprintSource": {
|
||||
"capability": "image.generate",
|
||||
"prompt": "hello",
|
||||
"settings": { "height": 768, "width": 1024 }
|
||||
},
|
||||
"fingerprint": "3ac3128766c0bdac36627b996cb5b3b1ed752794989d559c24f6621988e51a03",
|
||||
"conflictStatus": 409,
|
||||
"reusedStatus": 200,
|
||||
"createdStatus": 202
|
||||
},
|
||||
"priority": { "minimum": -100, "maximum": 100, "default": 0 },
|
||||
"publicList": { "defaultLimit": 50, "minimumLimit": 1, "maximumLimit": 200 },
|
||||
"claim": { "minimumBatch": 1, "maximumBatch": 20, "defaultLockTimeoutSeconds": 300 },
|
||||
"retry": {
|
||||
"defaultMaxAttempts": 3,
|
||||
"baseDelayMilliseconds": 10000,
|
||||
"maximumDelayMilliseconds": 300000,
|
||||
"cases": [
|
||||
{ "attemptsBefore": 0, "retryable": true, "delayMilliseconds": 10000, "action": "retry_scheduled" },
|
||||
{ "attemptsBefore": 1, "retryable": true, "delayMilliseconds": 20000, "action": "retry_scheduled" },
|
||||
{ "attemptsBefore": 2, "retryable": true, "delayMilliseconds": 40000, "action": "retry_scheduled" },
|
||||
{ "attemptsBefore": 3, "retryable": true, "action": "processed" },
|
||||
{ "attemptsBefore": 0, "retryable": false, "action": "processed" }
|
||||
]
|
||||
},
|
||||
"cancel": {
|
||||
"idempotentTerminal": true,
|
||||
"activeResult": "cancelled",
|
||||
"clearsLease": true,
|
||||
"refundKey": "job-refund:{jobId}"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"version": 1,
|
||||
"maximumAttempts": 3,
|
||||
"contentType": "application/json",
|
||||
"userAgent": "zhinian-aigc-webhook/1.0",
|
||||
"signatureHeader": "X-Zhinian-Signature",
|
||||
"secret": "webhook-secret",
|
||||
"job": {
|
||||
"id": "job-1",
|
||||
"status": "failed",
|
||||
"capability": "image.generate",
|
||||
"outputAssetIds": [],
|
||||
"error": { "message": "provider unavailable", "retryable": true },
|
||||
"updatedAt": "2026-08-13T08:00:00.000Z"
|
||||
},
|
||||
"body": "{\"jobId\":\"job-1\",\"status\":\"failed\",\"capability\":\"image.generate\",\"outputAssetIds\":[],\"error\":{\"message\":\"provider unavailable\",\"retryable\":true},\"updatedAt\":\"2026-08-13T08:00:00.000Z\"}",
|
||||
"signature": "sha256=32b8fd385692f6f549c0b1e1ffc9dce404c7a3a9a0aa19ca45225ad257d94411"
|
||||
}
|
||||
Reference in new issue
Block a user