core: sqlite checkpoint tweaks. Switch the periodic checkpoint to passive mode. Truncate mode was painful on mobile. I'm seeing it succeed often enough that we don't grow indefinitely. Also fix the print.
Some checks failed
Build Tilde Friends / Build-All (push) Has been cancelled
Some checks failed
Build Tilde Friends / Build-All (push) Has been cancelled
This commit is contained in:
parent
99a195a3fd
commit
4de53b9926
@ -191,8 +191,15 @@ class TfElement extends LitElement {
|
|||||||
try {
|
try {
|
||||||
while (true) {
|
while (true) {
|
||||||
let max_seen;
|
let max_seen;
|
||||||
for (let account_chunk = 0; account_chunk < ids.length; account_chunk += k_account_chunk_size) {
|
for (
|
||||||
let ids_chunk = ids.slice(account_chunk, account_chunk + k_account_chunk_size);
|
let account_chunk = 0;
|
||||||
|
account_chunk < ids.length;
|
||||||
|
account_chunk += k_account_chunk_size
|
||||||
|
) {
|
||||||
|
let ids_chunk = ids.slice(
|
||||||
|
account_chunk,
|
||||||
|
account_chunk + k_account_chunk_size
|
||||||
|
);
|
||||||
let abouts = await tfrpc.rpc.query(
|
let abouts = await tfrpc.rpc.query(
|
||||||
`
|
`
|
||||||
WITH
|
WITH
|
||||||
@ -464,16 +471,18 @@ class TfElement extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async load_recent_reactions() {
|
async load_recent_reactions() {
|
||||||
this.recent_reactions = (await tfrpc.rpc.query(
|
this.recent_reactions = (
|
||||||
`
|
await tfrpc.rpc.query(
|
||||||
|
`
|
||||||
SELECT DISTINCT content ->> '$.vote.expression' AS value
|
SELECT DISTINCT content ->> '$.vote.expression' AS value
|
||||||
FROM messages
|
FROM messages
|
||||||
WHERE author = ? AND
|
WHERE author = ? AND
|
||||||
content ->> '$.type' = 'vote'
|
content ->> '$.type' = 'vote'
|
||||||
ORDER BY timestamp DESC LIMIT 10
|
ORDER BY timestamp DESC LIMIT 10
|
||||||
`,
|
`,
|
||||||
[this.whoami]
|
[this.whoami]
|
||||||
)).map((x) => x.value);
|
)
|
||||||
|
).map((x) => x.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
async load() {
|
async load() {
|
||||||
|
@ -234,9 +234,9 @@
|
|||||||
<div class="w3-container w3-padding-64 w3-light-grey w3-center">
|
<div class="w3-container w3-padding-64 w3-light-grey w3-center">
|
||||||
<h1 class="w3-jumbo"><b>Built the Old Fashioned Way</b></h1>
|
<h1 class="w3-jumbo"><b>Built the Old Fashioned Way</b></h1>
|
||||||
<p>
|
<p>
|
||||||
Tilde Friends strives to use only simple and widely adopted
|
Tilde Friends strives to use only simple and widely adopted dependencies
|
||||||
dependencies in order to keep it easy to build for all sorts of
|
in order to keep it easy to build for all sorts of platforms and
|
||||||
platforms and maintainable for a very long time.
|
maintainable for a very long time.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Though of course for building Tilde Friends apps, you are free to use
|
Though of course for building Tilde Friends apps, you are free to use
|
||||||
|
@ -1469,9 +1469,9 @@ static void _tf_ssb_rpc_checkpoint(tf_ssb_t* ssb)
|
|||||||
sqlite3* db = tf_ssb_acquire_db_writer(ssb);
|
sqlite3* db = tf_ssb_acquire_db_writer(ssb);
|
||||||
int log = 0;
|
int log = 0;
|
||||||
int checkpointed = 0;
|
int checkpointed = 0;
|
||||||
if (sqlite3_wal_checkpoint_v2(db, NULL, SQLITE_CHECKPOINT_TRUNCATE, &log, &checkpointed) == SQLITE_OK)
|
if (sqlite3_wal_checkpoint_v2(db, NULL, SQLITE_CHECKPOINT_PASSIVE, &log, &checkpointed) == SQLITE_OK)
|
||||||
{
|
{
|
||||||
tf_printf("Checkpointed %d frames in %d ms. Log is now %d frames.\n", (int)((uv_hrtime() - checkpoint_start_ms) / 1000000LL), checkpointed, log);
|
tf_printf("Checkpointed %d frames in %d ms. Log is now %d frames.\n", checkpointed, (int)((uv_hrtime() - checkpoint_start_ms) / 1000000LL), log);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1541,7 +1541,7 @@ static void _tf_ssb_rpc_delete_blobs_work(tf_ssb_t* ssb, void* user_data)
|
|||||||
static void _tf_ssb_rpc_delete_blobs_after_work(tf_ssb_t* ssb, int status, void* user_data)
|
static void _tf_ssb_rpc_delete_blobs_after_work(tf_ssb_t* ssb, int status, void* user_data)
|
||||||
{
|
{
|
||||||
delete_t* delete = user_data;
|
delete_t* delete = user_data;
|
||||||
_tf_ssb_rpc_start_delete_blobs(ssb, delete->deleted ? (int)delete->duration_ms : (15 * 60 * 1000));
|
_tf_ssb_rpc_start_delete_blobs(ssb, delete->deleted ? (int)delete->duration_ms : (5 * 60 * 1000));
|
||||||
tf_free(delete);
|
tf_free(delete);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1532,11 +1532,7 @@ static char* _subprocess_check_output(const char* command)
|
|||||||
|
|
||||||
static bool _isspace(char c)
|
static bool _isspace(char c)
|
||||||
{
|
{
|
||||||
return
|
return c == ' ' || c == '\t' || c == '\r' || c == '\n';
|
||||||
c == ' ' ||
|
|
||||||
c == '\t' ||
|
|
||||||
c == '\r' ||
|
|
||||||
c == '\n';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static char* _trim(char* p)
|
static char* _trim(char* p)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user