forked from Telodendria/Telodendria
Notify the user about the minimum max-cache instead of silently setting it.
This commit is contained in:
parent
cd584c1e93
commit
0c6c1e5b19
3 changed files with 19 additions and 2 deletions
2
src/Db.c
2
src/Db.c
|
@ -236,7 +236,7 @@ DbOpen(char *dir, size_t cache)
|
|||
{
|
||||
Db *db;
|
||||
|
||||
if (!dir || cache < 1024)
|
||||
if (!dir || cache < DB_MIN_CACHE)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -449,7 +449,20 @@ main(int argc, char **argv)
|
|||
|
||||
if (!tConfig->maxCache)
|
||||
{
|
||||
Log(lc, LOG_WARNING, "Max-cache is set to zero; caching is disabled.");
|
||||
Log(lc, LOG_WARNING, "Max-cache is set to zero.");
|
||||
Log(lc, LOG_WARNING,
|
||||
"If this is not what you intended, check the config file");
|
||||
Log(lc, LOG_WARNING,
|
||||
"and ensure that max-cache is a valid number of bytes.");
|
||||
}
|
||||
|
||||
if (tConfig->maxCache < DB_MIN_CACHE)
|
||||
{
|
||||
Log(lc, LOG_WARNING,
|
||||
"Specified max cache size is less than the minimum of %d bytes.",
|
||||
DB_MIN_CACHE);
|
||||
Log(lc, LOG_WARNING, "Using a max-cache of %d bytes.", DB_MIN_CACHE);
|
||||
tConfig->maxCache = DB_MIN_CACHE;
|
||||
}
|
||||
|
||||
if (!matrixArgs.db)
|
||||
|
|
|
@ -24,6 +24,10 @@
|
|||
#ifndef TELODENDRIA_DB_H
|
||||
#define TELODENDRIA_DB_H
|
||||
|
||||
#ifndef DB_MIN_CACHE
|
||||
#define DB_MIN_CACHE 1024
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <HashMap.h>
|
||||
|
|
Loading…
Reference in a new issue