Skip to content
This repository has been archived by the owner on Nov 7, 2023. It is now read-only.

panarama360/ts-retry-decorator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ts-retry-decorator

ts-retry-decorator Based on promise-retry Base Usage

import {Retry} from "ts-retry-decorator";

class Example {
    @Retry({
        retries: 2,
        factor: 2,
        minTimeout: 1 * 1000,
        maxTimeout: 2 * 1000,
        randomize: true
    })
    retryFunction(){
        if(Math.random()*100 > 60)
            throw new Error("Error !!")
    }
}



async function start() {
    console.log('Start')
    const example = new Example()
    await example.retryFunction()
    console.log('Finish')
}

start().catch(reason => console.log(reason))

Releases

No releases published

Packages

No packages published