Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A less expensive TinyController.connected() #86

Open
thehabes opened this issue Apr 1, 2024 · 0 comments
Open

A less expensive TinyController.connected() #86

thehabes opened this issue Apr 1, 2024 · 0 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@thehabes
Copy link
Member

thehabes commented Apr 1, 2024

Current (4/1/24)

/** 
 * Generally check that the TinyPEN API is running.
 * Perform a query for an object we know is there.
 * @return boolean
 * */
async connected() {
    // Send a /query to ping TinyPen
    try{
        // FIXME something less expensive
        const theone = await this.find({ "_id": "11111" })
        return theone.length === 1    
    } catch(err){
        console.error(err)
        return false
    }
}

Is it possible to do something less expensive, such as a HEAD request of some kind instead?

@thehabes thehabes added enhancement New feature or request question Further information is requested labels Apr 1, 2024
@thehabes thehabes changed the title A less expensive TinyController.connect() test A less expensive TinyController.connected() test Apr 1, 2024
@thehabes thehabes changed the title A less expensive TinyController.connected() test A less expensive TinyController.connected() Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant