Skip to content

Commit

Permalink
Merge pull request SolrNet#401 from SolrNet/fix/395
Browse files Browse the repository at this point in the history
Fix async AtomicUpdate issue
  • Loading branch information
gjunge authored Feb 28, 2018
2 parents 53b7ff8 + 66b651a commit a4c8956
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions SolrNet/Commands/AtomicUpdateCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ public string Execute(ISolrConnection connection)
return connection.PostStream("/update", "text/json; charset=utf-8", content, GetParamsAsKvp());
}

public Task<string> ExecuteAsync(ISolrConnection connection)
public async Task<string> ExecuteAsync(ISolrConnection connection)
{
string json = GetAtomicUpdateJson();
var bytes = Encoding.UTF8.GetBytes(json);
using (var content = new MemoryStream(bytes))
return connection.PostStreamAsync("/update", "text/json; charset=utf-8", content, GetParamsAsKvp());
return await connection.PostStreamAsync("/update", "text/json; charset=utf-8", content, GetParamsAsKvp());
}

private KeyValuePair<string, string>[] GetParamsAsKvp()
Expand Down Expand Up @@ -111,4 +111,4 @@ private string ParseValue(object value)
throw new ArgumentNullException("Value for atomic update must be int, string or string[].");
}
}
}
}
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 1.0.7
- Fix: Parsing error when spellcheck.extendedResults=true #398 (@ariasjose)
- Tweaked the AutoSolrConnection `MaxUriLength`.
- Fix: AtomicUpdate async doesn't work due to stream being closed prematurely #401

## 1.0.6
- New: `AutoSolrConnection`, automatically uses `GET` or `POST` depending on uri length. Improved performance when using `async` methods.
Expand Down

0 comments on commit a4c8956

Please sign in to comment.