I've been testing hooks for the last little while and there's a few things that are not behaving as I expected.
I'm using the webhook settings with all hooks enabled and in both of the below log segments I'm logging the additional info with this line.
f' {payload.upload.id}: hook {hook_name}; method {payload.request.method}; is_final: {payload.upload.is_final}; is_partial: {payload.upload.is_partial};'
When doing a simple upload without concat I see the following logs:
8f40fed6-4431-4ee3-8506-2e08871af41d: hook pre-create; method POST; is_final: False; is_partial: False;
INFO: 127.0.0.1:63439 - "POST /rustus/callback HTTP/1.1" 200 OK
8f40fed6-4431-4ee3-8506-2e08871af41d: hook post-create; method POST; is_final: False; is_partial: False;
INFO: 127.0.0.1:63439 - "POST /rustus/callback HTTP/1.1" 200 OK
8f40fed6-4431-4ee3-8506-2e08871af41d: hook post-receive; method PATCH; is_final: False; is_partial: False;
INFO: 127.0.0.1:63439 - "POST /rustus/callback HTTP/1.1" 200 OK
8f40fed6-4431-4ee3-8506-2e08871af41d: hook post-finish; method PATCH; is_final: False; is_partial: False;
INFO: 127.0.0.1:63439 - "POST /rustus/callback HTTP/1.1" 200 OK
When doing an upload using concatenation of two parts I see this as the logs:
dad05558-2c08-4250-aaea-8238736c7ebb: hook pre-create; method POST; is_final: False; is_partial: True;
46c25c7d-6bfe-4486-a07e-9210cbd6f3d2: hook pre-create; method POST; is_final: False; is_partial: True;
INFO: 127.0.0.1:62958 - "POST /rustus/callback HTTP/1.1" 200 OK
INFO: 127.0.0.1:62959 - "POST /rustus/callback HTTP/1.1" 200 OK
dad05558-2c08-4250-aaea-8238736c7ebb: hook post-create; method POST; is_final: False; is_partial: True;
INFO: 127.0.0.1:62959 - "POST /rustus/callback HTTP/1.1" 200 OK
46c25c7d-6bfe-4486-a07e-9210cbd6f3d2: hook post-create; method POST; is_final: False; is_partial: True;
INFO: 127.0.0.1:62960 - "POST /rustus/callback HTTP/1.1" 200 OK
dad05558-2c08-4250-aaea-8238736c7ebb: hook post-finish; method PATCH; is_final: False; is_partial: True;
46c25c7d-6bfe-4486-a07e-9210cbd6f3d2: hook post-finish; method PATCH; is_final: False; is_partial: True;
INFO: 127.0.0.1:62960 - "POST /rustus/callback HTTP/1.1" 200 OK
INFO: 127.0.0.1:62959 - "POST /rustus/callback HTTP/1.1" 200 OK
cf318548-2c74-4a4f-bf02-c528f248e9d5: hook pre-create; method POST; is_final: True; is_partial: False;
INFO: 127.0.0.1:62962 - "POST /rustus/callback HTTP/1.1" 200 OK
cf318548-2c74-4a4f-bf02-c528f248e9d5: hook post-create; method POST; is_final: True; is_partial: False;
INFO: 127.0.0.1:62962 - "POST /rustus/callback HTTP/1.1" 200 OK
A few things that surprised me:
- None of the hooks for the simple upload are labeled as
is_final
- There is only a
pre-create
and post-create
event for the concatenation call.
- Only the concat related events are set as
is_final
- There's no
post-receive
events for partial uploads
This leads me to the following thoughts, and also wondering if these are correct assumptions:
- Fragmented uploads (concat enabled) are identifiable by looking at the
is_partial
flag.
- To understand upload progress I'd have to look at the offset/size information provided through
post_receive
hooks.
- Since concat enabled uploads don't get
post_receive
hooks I can't tell what's going on with them as they upload.
- To understand when a upload is finished I have to look for
post-create
hooks that have is_final: True
as well as post-finish
hooks.
Is all of the above correct? Are any of the above pointing to small bugs or logic errors in how the hooks are triggered?