Skip to content

Commit 68e99a4

Browse files
authored
Improve GridFSObservableSpec#cleanup when unsubscribing (#1834)
Slow down the writing of chunks. Sleep for longer between retries. JAVA-5998
1 parent feea1ad commit 68e99a4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

driver-scala/src/integrationTest/scala/org/mongodb/scala/gridfs/GridFSObservableSpec.scala

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package org.mongodb.scala.gridfs
1818

19+
import com.mongodb.client.gridfs.model.GridFSUploadOptions
20+
1921
import java.io.ByteArrayOutputStream
2022
import java.nio.ByteBuffer
2123
import java.nio.channels.Channels
@@ -345,7 +347,11 @@ class GridFSObservableSpec extends RequiresMongoDBISpec with FuturesSpec with Be
345347
override def onComplete(): Unit = completed = true
346348
}
347349
gridFSBucket
348-
.uploadFromObservable("myFile", Observable(List.fill(1024)(ByteBuffer.wrap(contentBytes))))
350+
.uploadFromObservable(
351+
"myFile",
352+
Observable(List.fill(1024)(ByteBuffer.wrap(contentBytes))),
353+
new GridFSUploadOptions().chunkSizeBytes(1024)
354+
)
349355
.subscribe(observer)
350356

351357
observer.subscription().request(1)
@@ -368,7 +374,7 @@ class GridFSObservableSpec extends RequiresMongoDBISpec with FuturesSpec with Be
368374
} catch {
369375
case e: Exception =>
370376
if (n > 1) {
371-
Thread.sleep(250)
377+
Thread.sleep(500)
372378
retry(n - 1)(fn)
373379
} else {
374380
throw e

0 commit comments

Comments
 (0)