Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pollInterval should be a Duration (semantically) #558

Closed
mazei513 opened this issue Feb 10, 2020 · 3 comments
Closed

pollInterval should be a Duration (semantically) #558

mazei513 opened this issue Feb 10, 2020 · 3 comments

Comments

@mazei513
Copy link

QueryOptions describes pollInterval as:

  /// The time interval (in milliseconds) on which this query should be
  /// re-fetched from the server.
  int pollInterval;

However, looking into QueryScheduler, it is used as seconds.

  void startPollingQuery(
    WatchQueryOptions options,
    String queryId,
  ) {
    assert(options.pollInterval != null && options.pollInterval > 0);

    registeredQueries[queryId] = options;

    final Duration interval = Duration(
      seconds: options.pollInterval,
    );

    if (intervalQueries.containsKey(interval)) {
      intervalQueries[interval].add(queryId);
    } else {
      intervalQueries[interval] = <String>[queryId];

      _pollingTimers[interval] = Timer.periodic(
        interval,
        (Timer timer) => fetchQueriesOnInterval(timer, interval),
      );
    }
  }

On package version 3.0.0.

@mazei513
Copy link
Author

Would like to suggest changing pollInterval to be a Duration instead.

@micimize micimize changed the title Wrong units in documentation for poll interval pollInterval should be a Duration (semantically) Feb 14, 2020
@micimize micimize changed the title pollInterval should be a Duration (semantically) pollInterval should be a Duration (semantically) Feb 14, 2020
@cihadturhan
Copy link

Hello,
I agree!
It says pollinterval is in milliseconds here:
https://github.com/zino-app/graphql-flutter/blob/master/packages/graphql/lib/src/core/query_options.dart#L129

but it's in seconds:
https://github.com/zino-app/graphql-flutter/blob/master/packages/graphql/lib/src/scheduler/scheduler.dart#L44

I tried 1000 and waited forever :)

I'm quite busy right now, but I'd like to send a PR if I have time in a few days.

@micimize
Copy link
Collaborator

micimize commented Oct 7, 2020

closed in 4.0.0-beta.1 #648

@micimize micimize closed this as completed Oct 7, 2020
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

No branches or pull requests

3 participants