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

Make FakeScheduler less flaky #92

Merged
merged 1 commit into from Oct 12, 2016
Merged

Conversation

jskeet
Copy link
Collaborator

@jskeet jskeet commented Oct 12, 2016

We now don't have the flaky "pause" at various points. This does mean that any scheduled actions can easily overlap each other in real time, but it's hard to fix that without flakiness. If it becomes an issue, we can add a configurable pause.

The API is now consistent and more clearly documented, and
has a couple of "guard" methods to prevent Run being called
accidentally instead of RunAsync. (I found I consistently made that
error.)

@jskeet jskeet force-pushed the fakescheduler branch 8 times, most recently from e01a9db to 8c7e2b8 Compare October 12, 2016 09:26
Copy link
Contributor

@chrisdunelm chrisdunelm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple of nits

});
}

This comment was marked as spam.

This comment was marked as spam.

@@ -88,7 +82,8 @@ public PollSource(TimeSpan timeToCompletion, int finalResult)
FinalResult = finalResult;
}

private int Poll(CallSettings callSettings) => Clock.GetCurrentDateTimeUtc() < CompletionTime ? 0 : FinalResult;
private int Poll(CallSettings callSettings) =>
Clock.GetCurrentDateTimeUtc() < CompletionTime? 0 : FinalResult;

This comment was marked as spam.

This comment was marked as spam.

}

/// <summary>
/// Shorthand method for "run for a logical day". See <see cref="RunUntil(DateTime)"/> for details.
/// <para>
/// Invokes the given action in a separate thread, and then runs the scheduler until of four conditions is met:

This comment was marked as spam.

This comment was marked as spam.

We now don't have the flaky "pause" at various points. This does mean that any scheduled actions can easily overlap each other in real time, but it's hard to fix that without flakiness. If it becomes an issue, we can add a configurable pause.

The API is now consistent and more clearly documented, and
has a couple of "guard" methods to prevent Run being called
accidentally instead of RunAsync. (I found I consistently made that
error.)

For some reason they fail - only on Travis - if run in parallel.
That shouldn't be the case, and I'll file a new issue about it, but
it can wait for now.
@jskeet jskeet merged commit e802c00 into googleapis:master Oct 12, 2016
@jskeet jskeet deleted the fakescheduler branch October 12, 2016 09:51
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

Successfully merging this pull request may close these issues.

None yet

2 participants