infostellarinc / stellarcli

A command line utility for accessing the StellarStation API
Apache License 2.0
5 stars 9 forks source link

STELLAR-3687 Auto close stream #136

Closed rockets3600 closed 4 years ago

rockets3600 commented 4 years ago

There are three new flags for satellite open-stream. --enable-auto-close When set to true, the stream will close after a specified auto close time. --auto-close-delay duration The duration to wait before ending the stream with no more data incoming. (default 5s) --auto-close-time string The datetime after which auto-closing will be enabled. (ie "2019-12-02 15:04:05")

When enabled the stream runs normally until "auto-close-time" has passed. After this point, if no telemetry is received for "auto-close-delay" time (default 5s), then the stream will close, the file-writer is flushed (if writing to a file), and the stellarcli will close. If telemetry is received during the auto close delay period, the delay will be refreshed back to it's initial setting and will countdown to exiting again.

danada commented 4 years ago

Think this would address https://github.com/infostellarinc/stellarcli/issues/122

@rockets3600 could you explain the usage and expected behaviour in the PR description? Thanks!

rockets3600 commented 4 years ago

@chelliwell We're curious about what you think concerning the flag usage for this. Is it okay to use the default values for delay and close time if they are not provided? Or would you prefer that if auto-close is on, the delay and close time must be set explicitly. Thanks!

danada commented 4 years ago

Also curious about the layout of params

--enable-auto-close true --auto-close-delay duration 5s --auto-close-time 2006-01-02'T'15:04:05Z

vs

--auto-close 5s 2006-01-02'T'15:04:05Z
chelliwell commented 4 years ago

@chelliwell We're curious about what you think concerning the flag usage for this. Is it okay to use the default values for delay and close time if they are not provided? Or would you prefer that if auto-close is on, the delay and close time must be set explicitly. Thanks!

I see that you've edited the top message in this thread. Is that now the up-to-date description of the parameters?

rockets3600 commented 4 years ago

@chelliwell We're curious about what you think concerning the flag usage for this. Is it okay to use the default values for delay and close time if they are not provided? Or would you prefer that if auto-close is on, the delay and close time must be set explicitly. Thanks!

I see that you've edited the top message in this thread. Is that now the up-to-date description of the parameters?

The description is a bit outdated right now. I'll update it once things are more settled and let you know that I've done so.

danada commented 4 years ago

Tested several times with auto close time set before and after the expected end of data transmission and saw good results.

One thing I didn't see documented anywhere is the behaviour of when the auto close time is set after the end of expected transmission. In my tests the stream closed 10s after the provided time, but it wasn't immediately obvious where the 10s came from.

danada commented 4 years ago

To clarify my last comment, the stream is closed at the provided timestamp + specified duration + stream latency. In my example I used a 5s duration and stream latency was ~5s so the stream was closed after 10 seconds. We can look into this duration at a later date.