Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Allow search jobs to be created if going into a queued state #91

Merged
merged 9 commits into from
Sep 6, 2019

Conversation

shakeelmohamed
Copy link
Contributor

No description provided.

@@ -234,12 +259,27 @@ async Task<Job> CreateAsync(IEnumerable<Argument> arguments, DispatchState requi

Job job = new Job(this.Context, this.Namespace, name: searchId);

await job.GetAsync().ConfigureAwait(false);
await job.GetAsync(requiredState).ConfigureAwait(false);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Previously in CreateAsync() we would ignore the requiredState value and by default wait for every job to reach a created state before returning - resulting in timeouts.

Copy link

Choose a reason for hiding this comment

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

This version will still time out if required state is running and we get queued though?

var dateString = input.ToString();
if (dateString.Trim().Equals(""))
{
return DateTime.MinValue;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The original XML parsing bug was addressed with this change

@@ -195,6 +195,31 @@ public override async Task<Job> CreateAsync(IEnumerable<Argument> arguments)
return job;
}

public virtual async Task<Job> Create(string search, int count = 0, // This version doesn't wait
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can remove these, but I wanted to add another Create() function that doesn't wait until a requiredStatus is reached

await job.TransitionAsync(requiredState).ConfigureAwait(false);

return job;
}

async Task<Job> Create(IEnumerable<Argument> arguments) // this version doesn't wait
Copy link
Contributor Author

Choose a reason for hiding this comment

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

internal helper used by the new Create() above


try
{
job = await service.Jobs.Create(searchPrefix + i.ToString(), args: jobArgs);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test uses the new Create()

@@ -470,7 +471,8 @@ public virtual async Task GetAsync(DispatchState dispatchState, int delay = 3000
await response.EnsureStatusCodeAsync(HttpStatusCode.OK).ConfigureAwait(false);
await this.ReconstructSnapshotAsync(response).ConfigureAwait(false);

if (this.DispatchState >= dispatchState)
// None or Parsing are the only states to continue checking status for
if (this.DispatchState >= dispatchState || this.DispatchState == DispatchState.Queued)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@zenmoto see the change here

@shakeelmohamed shakeelmohamed merged commit 9857964 into develop Sep 6, 2019
@shakeelmohamed shakeelmohamed deleted the temp branch September 6, 2019 22:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants