ChilliCream / ChilliCream/graphql-platform

StrawberryShake subscription returns before ready - timing issue

Open
#4,824 4 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

🌶️ strawberry shake 🔍 investigate Area: Subscriptions
Dominant language
C#
Stars
5.8k
Forks
810
Avg merge
15h 39m
Merged PRs (30d)
98

Description

Is there an existing issue for this?
  • I have searched the existing issues
Describe the bug
HT_subscription

Context:
Topic: Automated API/integration tests.
Project: dotgraphee
Issue: StrawberryShake's subscription .Watch().Subscribe() seem to return before the system is ready to receive subscriptions.
(Cleanup: .Subscribe() returns an IDisposable which is disposed by the test fixture TearDown. We didn't forget it. 😉 )
Workaround: Thread.Sleep(1000); after subscription is started. 😢

Steps to reproduce
  1. Set up a HotChocolate endpoint with subscriptions.
  2. Set up a StrawberryShake client to subscribe and trigger that subscription with a mutation.
  3. Create a test that calls the mutation immediately after starting the subscription, see image above. (dotgraphee is building a branch 'feature/strawberry-shake-client' that does step 1, 2 and 3.)
  4. Test may pass randomly or when run in isolation. Create several or run in loop to reproduce.
Relevant log output

No response

Additional Context?

No response

Product

Strawberry Shake

Version

12.6.2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the StrawberryShake subscription .Watch().Subscribe() path and the automated integration-test setup described in the issue. Reproduce the HotChocolate endpoint and client sequence with the mutation immediately after subscription, then verify repeated runs receive the subscription without Thread.Sleep(1000).

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, graphql
Domain
api, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.