lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



On May 20, 2009, at 10:33 PM, Marco Antonio Abreu wrote:

Hi Guys,
I am writting a script to copy some data from one database to another, this script will be running all the time, verifying if have something to copy. I need to wait for some seconds between two checks, to do not overload the
DB server or CPU.

What about using database change notification instead of polling? That way the database calls you when it has some changes, instead of you asking if there are any changes all the time...

How can I implement a function (or use if already has) to perform a "sleep",
to wait some (milli)seconds doing nothing.

If this was not mentioned already, Luiz Henrique de Figueiredo's lalarm could be used for that purpose:

http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/#lalarm

http://www.opengroup.org/onlinepubs/009695399/functions/alarm.html

Cheers,

--
PA.
http://alt.textdrive.com/nanoki/