SetInterval (and SetTimeout) terminating after 5-6 minutes

Hi. Newbie to Javascript and first time submitting on this forum, so please bear with me if I’m not following the forum’s protocol exactly.

I’m trying to run a simple test program where a user (me) clicks a button on my welcome page (frontend) which calls an asynchronous function in the backend called StandardVotingCycleMainLoop whose purpose is to trigger a setInterval(loop, 60000) statement. The’ loop’ function simply writes the timestamp to a collection called TimingCollection every one minute. Everything works fine until about 5-6 minutes have passed by when loop seems to abruptly terminate and TimingCollection is no longer updated. This is a consistent problem, even when I use setTimeout instead of setInterval. In doing a little research, I read a few posts suggesting that either a db-token or container timeout may be the source of the problem (uggh – a little beyond my skill set). If that’s the problem, what would I do (code-wise) to correct it and allow my loop to go on indefinitely? If this isn’t the problem, then what might be the source of the problem and how would I go about fixing it? I appreciate any help as I’ve been scratching my head for about five days on it. My code is below:

// FRONTEND – welcome page

$w . onReady ( function () {
$w ( ‘#button1’ ). onClick ( async () => {
$w ( ‘#text28’ ). text = await Standard_Voting_Cycle_Main_Loop ();
});
});

// BACKEND - backend/myjobs/standardvotingcycletiming.jsw

export async function Standard_Voting_Cycle_Main_Loop ( ) {

 const   setintervaltimerID   =   setInterval ( loop ,   60000 );   
 let   today   =   new   Date (); 
 return   today . getDate (). toString ();  // just to indicate on welcome page that setInterval was triggered 

}

export function loop ( ) {

wixData . query ( “TimingCollection” )
. find ()
. then (( results ) => {
if ( results . items . length == 1 ) {
let rowID = results . items [ 0 ]. _id ;
wixData . get ( “TimingCollection” , rowID )
. then (( item ) => {
let now = new Date ();
item . debugoneminutehousekeepingtimestamp = now ;
wixData . update ( “TimingCollection” , item );
});
}
});
return true;
}