I am using node js for my server where i am using setTimeout. It is working fine in my local server but when i deploy it stop working.
function StartReactionAndComment({ postObj }) {
console.log("Start Reaction and Comments");
console.log(postObj.length)
for (const post of postObj) {
console.log(post)
setTimeout(() => {
AddReactionToPost(post).then((res) => { MaintainPostData(res, null, post.postURN) });// for maintaining post data
AddCommentToPost(post).then((res) => { MaintainPostData(null, res, post.postURN) });
console.log("Reaction and Comment added successfully ");
}, 15000);
}
console.log("End Reaction and Comments");
}
I am expecting that this function (StartReactionAndComment) call AddReactionToPost & AddCommentToPost after a certain interval of time but it is not working as expected. I tried different things like node corn, setInterval ect. Note this code works fine in local server but not in actual server Currently I am using free server Cyclic