Skip to content

Commit 16361fa

Browse files
jpnurmiclaude
andcommitted
refactor(tus): append attachment-refs to event envelope
Instead of sending attachment-refs in a separate envelope, append them to the event envelope so the server can associate them in one request. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 14b3248 commit 16361fa

1 file changed

Lines changed: 1 addition & 22 deletions

File tree

src/transports/sentry_http_transport.c

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -495,9 +495,6 @@ resolve_and_send_external_attachments(http_transport_state_t *state,
495495
return;
496496
}
497497

498-
sentry_uuid_t event_id = sentry_uuid_from_string(uuid);
499-
sentry_envelope_t *tus_envelope = NULL;
500-
501498
size_t count = sentry_value_get_length(refs);
502499
for (size_t i = 0; i < count; i++) {
503500
sentry_value_t entry = sentry_value_get_by_index(refs, i);
@@ -512,15 +509,7 @@ resolve_and_send_external_attachments(http_transport_state_t *state,
512509
sentry__path_free(att_file);
513510

514511
if (file_size >= SENTRY_LARGE_ATTACHMENT_SIZE && state->has_tus) {
515-
if (!tus_envelope) {
516-
tus_envelope = sentry__envelope_new_with_dsn(state->dsn);
517-
if (tus_envelope) {
518-
sentry__envelope_set_event_id(tus_envelope, &event_id);
519-
}
520-
}
521-
if (tus_envelope) {
522-
tus_upload_ref(state, att_dir, entry, tus_envelope);
523-
}
512+
tus_upload_ref(state, att_dir, entry, envelope);
524513
if (!state->has_tus) {
525514
break;
526515
}
@@ -531,16 +520,6 @@ resolve_and_send_external_attachments(http_transport_state_t *state,
531520

532521
sentry_value_decref(refs);
533522

534-
if (tus_envelope) {
535-
sentry_prepared_http_request_t *req = sentry__prepare_http_request(
536-
tus_envelope, state->dsn, state->ratelimiter, state->user_agent);
537-
if (req) {
538-
http_send_request(state, req);
539-
sentry__prepared_http_request_free(req);
540-
}
541-
sentry_envelope_free(tus_envelope);
542-
}
543-
544523
sentry__path_free(refs_path);
545524
sentry__path_free(att_dir);
546525
}

0 commit comments

Comments
 (0)