Skip to content

New Rule: no-timeout-in-infinite-loop #4

Open
@Turbo87

Description

@Turbo87

http://ember-concurrency.com/docs/testing-debugging describes the problem quite well. These days we have access to rawTimeout() though, which can often solve the issue of the infinitely waiting test waiters.

Bad

pollForChanges: task(function * () {
  while (true) {
    yield pollServerForChanges();
    yield timeout(5000);
  }
})

Good

pollForChanges: task(function * () {
  while (true) {
    yield pollServerForChanges();
    yield rawTimeout(5000);
  }
})
pollForChanges: task(function * () {
  while (!Ember.testing) {
    yield pollServerForChanges();
    yield timeout(5000);
  }
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions