core/database: Remove db_load_idle()

This was added to help show the window faster.  Recent changes have made
it unnecessary.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2016-08-22 11:17:28 -04:00
parent 21a47ec3b8
commit 1b18177d0a
9 changed files with 8 additions and 28 deletions

View File

@ -129,17 +129,6 @@ void db_load(struct database *db)
file_close(&db->db_file);
}
static bool __db_load_idle(struct database *db)
{
db_load(db);
return true;
}
void db_load_idle(struct database *db)
{
idle_schedule(IDLE_SYNC, IDLE_FUNC(__db_load_idle), db);
}
struct db_entry *db_insert(struct database *db, const gchar *key)
{
struct db_entry *item = NULL;

View File

@ -196,7 +196,7 @@ void pl_user_init(struct queue_ops *ops)
{
user_pl_ops = ops;
db_init(&user_db, "playlist.user", true, &user_db_ops, 0);
db_load_idle(&user_db);
db_load(&user_db);
}
void pl_user_deinit()

View File

@ -290,7 +290,7 @@ static const struct db_ops album_ops = {
void album_db_init()
{
db_init(&album_db, "album.db", true, &album_ops, ALBUM_DB_MIN);
db_load_idle(&album_db);
db_load(&album_db);
}
void album_db_deinit()

View File

@ -61,7 +61,7 @@ static const struct db_ops artist_ops = {
void artist_db_init()
{
db_init(&artist_db, "artist.db", true, &artist_ops, 0);
db_load_idle(&artist_db);
db_load(&artist_db);
}
void artist_db_deinit()

View File

@ -59,7 +59,7 @@ static const struct db_ops genre_ops = {
void genre_db_init()
{
db_init(&genre_db, "genre.db", true, &genre_ops, 0);
db_load_idle(&genre_db);
db_load(&genre_db);
}
void genre_db_deinit()

View File

@ -63,7 +63,7 @@ static const struct db_ops library_ops = {
void library_db_init()
{
db_init(&library_db, "library.db", true, &library_ops, LIBRARY_DB_MIN);
db_load_idle(&library_db);
db_load(&library_db);
}
void library_db_deinit()

View File

@ -197,7 +197,7 @@ static const struct db_ops track_ops = {
void track_db_init()
{
db_init(&track_db, "track.db", false, &track_ops, TRACK_DB_MIN);
db_load_idle(&track_db);
db_load(&track_db);
}
void track_db_deinit()

View File

@ -107,9 +107,6 @@ void db_autosave(struct database *);
/* Called to read the database from disk. */
void db_load(struct database *);
/* Called to read the database from disk, but only when idle. */
void db_load_idle(struct database *);
/* Returns the size of the backing std::vector. */
unsigned int db_actual_size(const struct database *);

View File

@ -294,25 +294,19 @@ static void test_save_load()
for (i = N; i < (2 * N); i += 2)
db_remove(&db1, db_at(&db1, i));
/* Use db_load_idle() this time */
db_deinit(&db2);
db2.db_entries = g_ptr_array_new();
db2.db_keys = g_hash_table_new(g_str_hash, g_str_equal);
db_load_idle(&db2);
g_assert_cmpuint(db2.db_size, ==, 0);
while (idle_run_task()) {};
db_load(&db2);
g_assert_cmpuint(db2.db_size, ==, N / 2);
/* Use db_load_idle() again */
db_save(&db1);
db_deinit(&db2);
db2.db_entries = g_ptr_array_new();
db2.db_keys = g_hash_table_new(g_str_hash, g_str_equal);
db_load_idle(&db2);
g_assert_cmpuint(db2.db_size, ==, 0);
while (idle_run_task()) {};
db_load(&db2);
g_assert_cmpuint(db2.db_size, ==, N);
g_assert_cmpuint(db_actual_size(&db2), ==, 2 * N);