diff options
author | Lennart Poettering <lennart@poettering.net> | 2011-12-29 15:25:42 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2011-12-29 15:25:42 +0100 |
commit | 54a7b863dd3937893abae47b20b6f655b8e9252a (patch) | |
tree | 1d630cf5dfce9b81945fd1ee3b0108e7cd15119f /src/journal | |
parent | cf244689e9d1ab50082c9ddd0f3c4d1eb982badc (diff) |
journald: don't recheck /var availability more often than 30s
Diffstat (limited to 'src/journal')
-rw-r--r-- | src/journal/journald.c | 16 | ||||
-rw-r--r-- | src/journal/sd-journal.h | 1 |
2 files changed, 16 insertions, 1 deletions
diff --git a/src/journal/journald.c b/src/journal/journald.c index 1efe0420db..52cdc7058c 100644 --- a/src/journal/journald.c +++ b/src/journal/journald.c @@ -51,6 +51,8 @@ #define RECHECK_AVAILABLE_SPACE_USEC (30*USEC_PER_SEC) +#define RECHECK_VAR_AVAILABLE_USEC (30*USEC_PER_SEC) + typedef struct StdoutStream StdoutStream; typedef struct Server { @@ -78,6 +80,8 @@ typedef struct Server { uint64_t cached_available_space; usec_t cached_available_space_timestamp; + uint64_t var_available_timestamp; + LIST_HEAD(StdoutStream, stdout_streams); unsigned n_stdout_streams; } Server; @@ -1200,12 +1204,22 @@ static int server_flush_to_var(Server *s) { int r; sd_id128_t machine; sd_journal *j; + usec_t ts; assert(s); + if (!s->runtime_journal) + return 0; + + ts = now(CLOCK_MONOTONIC); + if (s->var_available_timestamp + RECHECK_VAR_AVAILABLE_USEC > ts) + return 0; + + s->var_available_timestamp = ts; + system_journal_open(s); - if (!s->system_journal || !s->runtime_journal) + if (!s->system_journal) return 0; r = sd_id128_get_machine(&machine); diff --git a/src/journal/sd-journal.h b/src/journal/sd-journal.h index f6b1c955fb..97f9f0fa13 100644 --- a/src/journal/sd-journal.h +++ b/src/journal/sd-journal.h @@ -36,6 +36,7 @@ * - accelerate looking for "all hostnames" and suchlike. * - hookup with systemctl * - handle incomplete header + * - write unit files * * - local deserializer * - http server |