Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 2 Support (Qt 5) › Help with threading

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #21790

    jrrobles79

    Hello, can you help me with a good tutorial on threads on felgo and qml?, I have been looking for one to help solve some problems with the Timers, but I beggining to think that the timers are not the answer.  

     

    I need to check on an api that is only available on certain period of time, I created two Timers, the first one sync with the server time, to determine the period of time the api will be open, and the second timer check the server timestamp (on the timer) to trigger the call on the api. The problem is that in some points the timers got blocked , slowed and freeze by something, and I dont know why:

     

    on dataModel:

     

    apiNextEvent:   api.getNextEvent( function(data){

    serverTimer.serverTimeStamp =    data.current_server_time

    eventTimer.nextEvent = data.next_event_timestamp

    eventTimer.nextEventClose = data.next_event_close_timestamp

    serverTimer.start()

    }, function(error){ … })

     

    on serverTimer:

     

    Timer{

    id: serverTimer

    property date serverTimeStamp: “2000-01-01 00:00:00”

    onTriggered: {

           serverTimeStamp = new Date( serverTimeStamp.getTime()+1000) 

    }

    }

     

    Timer{

    id: eventTimer

    property date nextEvent: “2000-01-01 00:00:00”

    property date nextEventClose: “2000-01-01 00:00:00”

    onTriggered:{

          if(  dateBetween( .serverTimer.serverTimeStamp,  nextEvent, nextEventClose  ) ){

            logic.getEventInfo()

    } 

    }

    }

     

     

    NOTE:  I can’t create a timer that keep checking on the   logic.getEventInfo() It will throwing only errors for most of the time

     

     

     

Viewing 1 post (of 1 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded