Skip to content

Commit

Permalink
fix: Dispose the stream
Browse files Browse the repository at this point in the history
  • Loading branch information
Rishabh-V committed May 23, 2023
1 parent f89ba63 commit d92f88e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Expand Up @@ -76,6 +76,12 @@ public void Close()
{
return;
}

if (_resultStream is IDisposable disposable)
{
disposable.Dispose();
}

IsClosed = true;
StreamClosed?.Invoke(this, new StreamClosedEventArgs());
}
Expand Down
@@ -1,4 +1,4 @@
// Copyright 2019 Google LLC
// Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -29,7 +29,7 @@ namespace Google.Cloud.Spanner.V1
/// <summary>
/// Implements buffering, retry and resume for the results of executing streaming SQL and read calls.
/// </summary>
internal sealed class ResultStream : IAsyncStreamReader<PartialResultSet>
internal sealed class ResultStream : IAsyncStreamReader<PartialResultSet>, IDisposable
{
/// <summary>
/// The default maximum buffer size. Currently this isn't user-tweakable; we don't expect to see more than this many
Expand Down

0 comments on commit d92f88e

Please sign in to comment.