Skip to content

feat: add skip_result label to skip result backend storage - #656

Open
vvanglro wants to merge 1 commit into
taskiq-python:masterfrom
vvanglro:feat/skip-result-label
Open

feat: add skip_result label to skip result backend storage#656
vvanglro wants to merge 1 commit into
taskiq-python:masterfrom
vvanglro:feat/skip-result-label

Conversation

@vvanglro

@vvanglro vvanglro commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add a skip_result task label so selected tasks can opt out of result backend storage without raising NoResultError.
  • Only boolean values are accepted (True / False); missing label means store results as usual; invalid values raise ValueError.
  • When skip_result=True, the worker skips result_backend.set_result and post_save middleware hooks, while acknowledgement (including when_saved) still proceeds.
  • Document the label in getting started, architecture overview, and result backends docs; extend with_labels typing to include bool / bytes.

Usage

@broker.task(skip_result=True)
async def push_notification(user_id: int) -> None:
    ...


await push_notification.kicker().with_labels(skip_result=True).kiq(user_id=1)

This is complementary to raising NoResultError for runtime decisions.

Test plan

  • Added receiver tests for decorator label, kicker label, skip_result=False, invalid value, and when_saved ack behavior
  • pytest tests/receiver/ passes locally

AI Disclaimer

This PR was developed with the assistance of either Claude or Codex. I've reviewed and verified the changes.

Allow fire-and-forget tasks to opt out of result storage via the
skip_result boolean label on @broker.task or kicker.with_labels.
@codecov

codecov Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.41%. Comparing base (ae2b788) to head (3d514c1).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #656      +/-   ##
==========================================
+ Coverage   81.29%   81.41%   +0.11%     
==========================================
  Files          69       69              
  Lines        2577     2593      +16     
==========================================
+ Hits         2095     2111      +16     
  Misses        482      482              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant