Skip to content

Calling two mutations at the same time from different requests run serially #134

@gakio12

Description

@gakio12

I understand that the GraphQL spec calls for mutations called from the same request be executed serially, however currently two separate requests calling mutations at the same time are also run serially. How do we call resolve such that each request is treated as a different object and we can have two clients running mutations at the same time? I've tried creating a new Operations object prior to each resolve call, but it is still deferring execution of the second client's request until the first client's request is finished.

For example, when calling Client 1 and then calling Client 2 (3x) while Client 1 is executing:

Client 1

mutation a50 {
  sleep(time: 50)
}

Client 2

mutation a5 {
  sleep(time: 5)
}

Expected output (and output from the Graphene python library)

Starting to sleep for 50 seconds.
Starting to sleep for 5 seconds.
Done sleeping!
Starting to sleep for 5 seconds.
Done sleeping!
Starting to sleep for 5 seconds.
Done sleeping!
Done sleeping!

Actual output

<2020-12-17 16:37:12.660> Starting to sleep for 50 seconds.
<2020-12-17 16:38:02.660> Done sleeping!
<2020-12-17 16:38:02.661> Starting to sleep for 5 seconds.
<2020-12-17 16:38:07.661> Done sleeping!
<2020-12-17 16:38:07.661> Starting to sleep for 5 seconds.
<2020-12-17 16:38:12.662> Done sleeping!
<2020-12-17 16:38:12.662> Starting to sleep for 5 seconds.
<2020-12-17 16:38:17.662> Done sleeping!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions