Jump to content

Difference between TUniTimer and TUniThreadTimer


harishrohokale

Recommended Posts

  • Administrators

TUniTimer has a client side component which is a Javascript timer. When timer event occurs on client it sends an Ajax request and server will serve it in a server side handler. It works synchronously with its session and can interact with visual controls.

 

TuniThreadTimer is a server side timer. It runs in server in its own thread and has no connection to client side. It is not bound to any session. It can be used to run server side tasks and other internal tasks.

  • Upvote 1
Link to comment
Share on other sites

  • 1 year later...
  • Administrators

Is it possible to set Unitimer1.enabled := False from Tunitimer.ontimer event? When I do this, client keeps sending ajax request . Should I stop it using javascrip using session.addjs(); could someone show me how to to do this?

 

Yes,you can but if your timer is too fast it may take a while until it stops.

 

What is the interval of your timer?

 

You can also set ChainMode to True to see if it makes any difference.

Link to comment
Share on other sites

Hi, 5 seconds.My idea is to stop unitimer at the begining of the event and restart it after finish his function. Something like this:

ontimEvent
begin

   ontimer.enabled := False;

   somefunctionshere();

   ontimer.enabled := True;

end;

But the ontimer keeps adding events

Link to comment
Share on other sites

  • Administrators

Hi, 5 seconds.My idea is to stop unitimer at the begining of the event and restart it after finish his function. Something like this:

ontimEvent
begin

   ontimer.enabled := False;

   somefunctionshere();

   ontimer.enabled := True;

end;

But the ontimer keeps adding events

 

Use ChainMode = True for this.

In this mode timer will not create more events until pending event is handled.

  • Upvote 1
Link to comment
Share on other sites

  • 7 months later...

If I want to update a TUniTreeView via a thread with data from a database.  Would I need to use a TUniThreadTimer to retreive the data from the DB into some internal list

and then have a TUniTimer process this list and update the treeview? 

 

I assume I can't just use a TUniTimer by itself to retrieve the data from the DB and update the treeview?

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...