Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

Commit

Permalink
log: prevent 'flush' and '.' from being logged on their own.
Browse files Browse the repository at this point in the history
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 .
  • Loading branch information
jeffkaufman committed Dec 17, 2015
1 parent f3edc3b commit b6a955a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions pagespeed/system/system_cache_path.cc
Expand Up @@ -144,11 +144,11 @@ SystemCachePath::~SystemCachePath() {
}

// static
GoogleString SystemCachePath::CacheKey(SystemRewriteOptions* config) {
GoogleString SystemCachePath::CachePath(SystemRewriteOptions* config) {
return (config->unplugged()
? "<unplugged>"
: StrCat(config->file_cache_path(),
config->enable_cache_purge() ? "\npurge\n" : "\nflush\n",
config->enable_cache_purge() ? " purge " : " flush ",
config->cache_flush_filename()));
}

Expand Down
4 changes: 2 additions & 2 deletions pagespeed/system/system_cache_path.h
Expand Up @@ -59,8 +59,8 @@ class SystemCachePath {
~SystemCachePath();

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

// Per-process in-memory LRU, with any stats/thread safety wrappers, or NULL.
CacheInterface* lru_cache() { return lru_cache_; }
Expand Down
6 changes: 3 additions & 3 deletions pagespeed/system/system_caches.cc
Expand Up @@ -119,14 +119,14 @@ void SystemCaches::ShutDown(MessageHandler* message_handler) {
}

SystemCachePath* SystemCaches::GetCache(SystemRewriteOptions* config) {
GoogleString key = SystemCachePath::CacheKey(config);
GoogleString path = SystemCachePath::CachePath(config);
SystemCachePath* system_cache_path = NULL;
std::pair<PathCacheMap::iterator, bool> result = path_cache_map_.insert(
PathCacheMap::value_type(key, system_cache_path));
PathCacheMap::value_type(path, system_cache_path));
PathCacheMap::iterator iter = result.first;
if (result.second) {
iter->second = system_cache_path =
new SystemCachePath(key, config, factory_, shared_mem_runtime_);
new SystemCachePath(path, config, factory_, shared_mem_runtime_);
factory_->TakeOwnership(system_cache_path);
} else {
system_cache_path = iter->second;
Expand Down

0 comments on commit b6a955a

Please sign in to comment.