import { RequestOptions } from "https" ; import * as urlModule from "url" ; import { IBackoffStrategy } from "./backoff/backoff" ; export class Host { public readonly url : urlModule . Url ; param url param backoff constructor ( url , private backoff , public readonly options ) { this . url = urlModule . parse ( url ) ; } return public fail ( ) { const value = this . backoff . getDelay ( ) ; this . backoff = this . backoff . next ( ) ; return value ; } /**
     * Should be called when a successful operation is run against the host.
     * It resets the host's backoff strategy.
     */ public success ( ) { this . backoff = this . backoff . reset ( ) ; } }