monit-dev
[Top][All Lists]
Advanced

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

Re: replace finalize_files() ?


From: Martin Pala
Subject: Re: replace finalize_files() ?
Date: Mon, 15 Sep 2003 00:33:22 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030908 Debian/1.4-4

Jan-Henrik Haukeland wrote:

Martin Pala <address@hidden> writes:

Hi,

i think it could be good to replace finalize_files() function with
direct call of unlink(Run.pidfile). The present implementation does
exactly the same thing:

--SNIP--
/**
* Remove temporary files
*/
void finalize_files() {

 unlink(Run.pidfile);

}
--SNIP--

In the code are on the same level as finalize_files() called other
standalone file handling functions for similar intent - such as
state_finalize(), log_close(), etc. I think there is no reason to keep
it - the code can be more clear without it and the code can be faster
without it (it will not improve performance very much, but why to pay
for something, which is not necesary :)

May we replace it?

Ah, if you feel strongly for it then replace it (although I have to
say that I like it). The intention is to have a common placeholder for
finalizing all files used within monit, but since state does it's own
unlinking[*] only the monit.pidfile is finalized in this function, but
this may change in the future(?).

The reason for having state_finalize() is based on the same idea, even
if it now only unlinks the state.file, but other state cleanup code
may be necessary in the future, so it's also a placeholder. But to
keep the rationale for having finalize_files, maybe instead of
removing it, we should put the unlink of the state file in this
function and remove state_finalize() instead. It's better, at least in
my book.

No problem, we can keep it :)

I understand the intent, but only because of mentioned state_finalize and log_close i though that this placeholder will never be extended by another functions => as interface to one simple function can be ommited (similarily to part of extreme programming rules). state_finalize join is probably not possible (for example during reload we only remove pidfile via finalize_files, but we need to keep the state file.

Martin





reply via email to

[Prev in Thread] Current Thread [Next in Thread]