Skip to content
This repository was archived by the owner on Apr 10, 2025. It is now read-only.

Commit b6a955a

Browse files
committed
log: prevent 'flush' and '.' from being logged on their own.
The system_cache_path is logged on startup and on some errors. It has newlines in it, used as a separator. This means you get log lines like: 2015/12/17 13:27:00 [info] 105645#0: \ [ngx_pagespeed 1.10.0.0-7582] Initializing shared memory for path: \ /home/jefftk/ngx_pagespeed/test/tmp/file-cache/ flush . This change makes us use spaces instead so you get: 2015/12/17 13:27:00 [info] 105645#0: \ [ngx_pagespeed 1.10.0.0-7582] Initializing shared memory for path: \ /home/jefftk/ngx_pagespeed/test/tmp/file-cache/ flush .
1 parent f3edc3b commit b6a955a

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

pagespeed/system/system_cache_path.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,11 @@ SystemCachePath::~SystemCachePath() {
144144
}
145145

146146
// static
147-
GoogleString SystemCachePath::CacheKey(SystemRewriteOptions* config) {
147+
GoogleString SystemCachePath::CachePath(SystemRewriteOptions* config) {
148148
return (config->unplugged()
149149
? "<unplugged>"
150150
: StrCat(config->file_cache_path(),
151-
config->enable_cache_purge() ? "\npurge\n" : "\nflush\n",
151+
config->enable_cache_purge() ? " purge " : " flush ",
152152
config->cache_flush_filename()));
153153
}
154154

pagespeed/system/system_cache_path.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ class SystemCachePath {
5959
~SystemCachePath();
6060

6161
// Computes a key suitable for building a map to help share common cache
62-
// objects between vhosts.
63-
static GoogleString CacheKey(SystemRewriteOptions* config);
62+
// objects between vhosts. This key is given to the constructor as 'path'.
63+
static GoogleString CachePath(SystemRewriteOptions* config);
6464

6565
// Per-process in-memory LRU, with any stats/thread safety wrappers, or NULL.
6666
CacheInterface* lru_cache() { return lru_cache_; }

pagespeed/system/system_caches.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,14 @@ void SystemCaches::ShutDown(MessageHandler* message_handler) {
119119
}
120120

121121
SystemCachePath* SystemCaches::GetCache(SystemRewriteOptions* config) {
122-
GoogleString key = SystemCachePath::CacheKey(config);
122+
GoogleString path = SystemCachePath::CachePath(config);
123123
SystemCachePath* system_cache_path = NULL;
124124
std::pair<PathCacheMap::iterator, bool> result = path_cache_map_.insert(
125-
PathCacheMap::value_type(key, system_cache_path));
125+
PathCacheMap::value_type(path, system_cache_path));
126126
PathCacheMap::iterator iter = result.first;
127127
if (result.second) {
128128
iter->second = system_cache_path =
129-
new SystemCachePath(key, config, factory_, shared_mem_runtime_);
129+
new SystemCachePath(path, config, factory_, shared_mem_runtime_);
130130
factory_->TakeOwnership(system_cache_path);
131131
} else {
132132
system_cache_path = iter->second;

0 commit comments

Comments
 (0)