Jump to content

problem with UniThreadTimer


erich.wanker

Recommended Posts

Hi,

a uniGui App on IIS with Hyperserver does not start the daily task correctly- what i need for importing data every 24 hours 

 

How i use the UniThreadTimer:

 

on Servermodule - i have a uniThreadTimer with intervall 2000000  (0,5 hours)

procedure TUniServerModule.UniThreadTimer1Timer( Sender : TObject );
      
  begin

    disconnect_to_my_mysql_database;

    connect_to_my_mysql_database;

    read_last_sync_date_in_table_settings;

    if last_sync_date <> actual_date
    then

    begin

      UniThreadTimer1.Lock;

      ..
      do my things

         UniThreadTimer1.unLock;

    end;

  end;

 

Any Idea why this not work correctly?

ThanX for help

Erich

Link to comment
Share on other sites

Hi,

Hyper server and persistent node zero.

 

Persistent Node Zero

Persistent Node Zero is a Node with Id = zero (0) and it is guaranteed to run continuously, i.e. it will never be permanently unloaded. However, it will be occasionally recycled like any other Node. Again, it is guaranteed that it will be reloaded immediately after it is recycled. Main purpose of a Persistent Node is to make sure that you have at least one Node running at a time. Consider a scenario where your uniGUI application should perform a background task in a thread, possibly in a TUniThreadTimer placed on a ServerModule. In a classical uniGUI app there is only one process, so your background task is guaranteed to run in form of a Singleton. However, in HyperServer  where multiple copies of same process are running concurrently, there should be a mechanism to ensure your Singleton method will run only in one of the Nodes. Persistent Node Zero option perfectly serves this purpose. All you need to do is enabled this option and checking Node Id in your uniGUI application. If boolean property in ServerModule named NodeZero is True, then it is safe to run your background task.

Link to comment
Share on other sites

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...