Remove async_fetch population, will be switching over to stubs index

master
teknomunk 1 year ago
parent 18536975e4
commit 9a1edead5f

@ -365,7 +365,8 @@ cleanup:
failed:
if( s ) {
printf( "Creating stub status for later sync\n" );
status_flag_for_async_fetch(s);
char filename[512];
ffdb_trie_set( "data/statuses/stubs", format(filename,512,"%d",s->id), "T" );
goto cleanup;
}
@ -570,43 +571,12 @@ void status_delete( struct status* s )
}
char filename[512];
ffdb_trie_remove( "data/statuses/stubs", format(filename,512,"%d",s->id) );
get_status_data_filename(s->id,filename,sizeof(filename));
remove(filename);
status_free(s);
}
struct async_status_fetch
{
struct {
int* items;
int count;
} ids;
};
#define OBJ_TYPE struct async_status_fetch
static struct json_object_field async_fetch_layout[] = {
JSON_FIELD_ARRAY_OF_INTS( ids, true ),
JSON_FIELD_END
};
#undef OBJ_TYPE
void status_flag_for_async_fetch( struct status* s )
{
struct async_status_fetch fetch;
memset( &fetch, 0, sizeof(fetch) );
json_read_object_layout_from_file( "data/statuses/async_fetch.json", async_fetch_layout, &fetch );
// Don't add if already flagged for async fetch
for( int i = 0; i < fetch.ids.count; ++i ) {
if( fetch.ids.items[i] == s->id ) {
goto already_present;
}
}
array_append( &fetch.ids, sizeof(s->id), &s->id );
json_write_object_layout_to_file( "data/statuses/async_fetch.json", "\t", async_fetch_layout, &fetch );
already_present:
free( fetch.ids.items );
}
void status_add_to_timeline( struct status* s, int timeline_id )
{

Loading…
Cancel
Save