File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,13 +21,15 @@ class RandomType(graphene.ObjectType):
2121
2222class Subscription (graphene .ObjectType ):
2323
24- count_seconds = graphene .Int ()
24+ count_seconds = graphene .Int (up_to = graphene . Int () )
2525
2626 random_int = graphene .Field (RandomType )
2727
2828
29- def resolve_count_seconds (root , info ):
30- return Observable .interval (1000 ).map (lambda i : "{0}" .format (i ))
29+ def resolve_count_seconds (root , info , up_to ):
30+ return Observable .interval (1000 )\
31+ .map (lambda i : "{0}" .format (i ))\
32+ .take_while (lambda i : int (i ) <= up_to )
3133
3234 def resolve_random_int (root , info ):
3335 import random
Original file line number Diff line number Diff line change 11import json
22
33from graphql import format_error , graphql
4+ from graphql .execution .executors .sync import SyncExecutor
45from rx import Observer , Observable
56from .server import BaseWebSocketSubscriptionServer , ConnectionContext , ConnectionClosedException
67from .constants import *
You can’t perform that action at this time.
0 commit comments