Search code examples
javascriptnode.jsfirebase-realtime-databasees6-promisegithub-actions

GitHub Workflow is not terminating


I have created a GitHub workflow which runs a node script, to test it I made it to run on a manual trigger. this is the code of my workfow file:

on:
   workflow_dispatch:
    inputs:
      logLevel:
        description: 'Log level'     
        required: true
        default: 'warning'
      tags:
        description: 'Test scenario tags' 

this workflow runs a Node.js script which basically fetches data from Firebase real-time database and then posts data to Twitter. The script is doing its job perfectly but the problem is that workflow is not terminating at all. Once I have once manually triggered it, it worked properly but when I noticed after 25 minutes it didn't got terminated and was running for 25 min.

The workflow terminated when I just used only Twitter API but this problem started after I added Firebase code. Please help me.

Here is my code:

db.once('value').then(snapshot=>{
    let v = snapshot.val();  
    let m = modifiyData(v);
    T.post(
        'statuses/update',
        { status: m },
        function (_err, data) {
            console.log( 'Successfully posted the tweet!',data );
        }
    )
});

Solution

  • Be sure to call delete() on the Firebase app object you previously initialized. Only call this after you are completely done with it for the process. As the API docs state:

    this method must be called to ensure graceful termination of the process