[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: icecream/daemon
From: Luboš Luňák <l.lunak () kde ! org>
Date: 2012-07-30 17:54:11
Message-ID: 20120730175411.4211DAC7A9 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1308593 by lunakl:
check env cache size also when creating new native environment
Otherwise too many plugin combinations (or the host never getting
new envs from other hosts) could make the cache grow a lot.
M +14 -7 main.cpp
--- trunk/icecream/daemon/main.cpp #1308592:1308593
@@ -472,6 +472,7 @@
bool reconnect();
int working_loop();
bool setup_listen_fds();
+ void check_cache_size( const string &new_env );
};
bool Daemon::setup_listen_fds()
@@ -846,7 +847,17 @@
log_error() << "installed " << current << " size: " << installed_size
<< " all: " << cache_size << endl;
}
+ check_cache_size( current );
+ bool r = reannounce_environments(); // do that before the file compiles
+ // we do that here so we're not given out in case of full discs
+ if ( !maybe_stats(true) )
+ r = false;
+ return r;
+}
+
+void Daemon::check_cache_size( const string &new_env )
+{
time_t now = time( NULL );
while ( cache_size > cache_size_limit ) {
string oldest;
@@ -889,7 +900,7 @@
}
}
}
- if ( oldest.empty() || oldest == current )
+ if ( oldest.empty() || oldest == new_env )
break;
size_t removed;
if (oldest_is_native) {
@@ -902,12 +913,6 @@
cache_size -= min( removed, cache_size );
envs_last_use.erase( oldest );
}
-
- bool r = reannounce_environments(); // do that before the file compiles
- // we do that here so we're not given out in case of full discs
- if ( !maybe_stats(true) )
- r = false;
- return r;
}
bool Daemon::handle_get_native_env( Client *client, GetNativeEnvMsg *msg )
@@ -957,6 +962,8 @@
}
env.extrafilestimes = extrafilestimes;
save_compiler_timestamps(env.gcc_bin_timestamp, env.gpp_bin_timestamp, env.clang_bin_timestamp);
+ envs_last_use[ native_environments[ env_key ].name ] = time( NULL );
+ check_cache_size( env.name );
}
UseNativeEnvMsg m( native_environments[ env_key ].name );
if (!client->channel->send_msg( m )) {
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic