Skip to content

Commit dab996d

Browse files
authored
Ruby flush note (#1459)
1 parent 7b182cb commit dab996d

File tree

1 file changed

+3
-2
lines changed
  • src/connections/sources/catalog/libraries/server/ruby

1 file changed

+3
-2
lines changed

src/connections/sources/catalog/libraries/server/ruby/index.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ Segment::Analytics.new({
454454

455455
## Flush
456456

457-
If you're running any sort of script or internal queue system to upload data, you should call `Analytics.flush` at the end of execution to ensure that all messages are sent to our servers. It's also recommended you call this method on shutdown to ensure all queued messages are uploaded to Segment.
457+
If you're running a script or internal queue system to upload data, you should call `Analytics.flush` at the end of execution to ensure that all of your messages are sent to our servers. Segment also recommendeds that you call `flush` on shutdown, so that all queued messages are sent to Segment instead of waiting for the next launch.
458458

459459
```ruby
460460
AppAnalytics = Segment::Analytics.new({
@@ -463,7 +463,8 @@ AppAnalytics = Segment::Analytics.new({
463463
AppAnalytics.flush
464464
```
465465

466-
Calling flush will block execution until all messages are processed, so it is not recommended in normal execution of your production application.
466+
> success ""
467+
> **Tip**: When you call `flush`, the call blocks execution on the thread until it finishes processing all the messages in the queue. If you want to call `flush` during the normal operation of your application, you can spawn a local worker thread and call flush on the worker. This prevents the call from blocking the main thread.
467468
468469

469470
## Turbolinks

0 commit comments

Comments
 (0)