Added retry delay persistence.

It dies if an empty filename was provided.
On Dec 29, 2014 6:20 PM, "Alex Zolotarev" <notifications@github.com> wrote:

> In FileStorageQueue/exponential_retry_strategy.h
> <https://github.com/KnowSheet/Sandbox/pull/16#discussion-diff-22338398>:
>
> > @@ -51,15 +52,24 @@ class ExponentialDelayRetryStrategy {
> >                                           const double max = 24 * 60 * 60 * 1e3)
> >        : ExponentialDelayRetryStrategy(file_system, DistributionParams(mean, min, max)) {
> >    }
> > -#if 0
> > -  void AttachToFile(const std::string filename) {
> > -    // TODO(dkorolev): File persistence.
> > +  void AttachToFile(const std::string& filename) {
> > +    if (!filename.empty()) {
> > +      persistence_filename_ = filename;
> > +      // First, resume delay, is possible.
> > +      // Then, save it to a) ensure the file exists, and b) update its timestamp.
> > +      ResumeStateFromFile();
> > +      SaveStateToFile();
> > +    } else {
> > +      throw FSQException();
>
> It is an overkill to die by exception if you can't save retry strategy.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/KnowSheet/Sandbox/pull/16/files#r22338398>.
>