mirror of
https://blitiri.com.ar/repos/chasquid
synced 2025-12-19 14:57:04 +00:00
Make the max queue size and give up time configurable
Today, the maximum number of items in the queue, as well as how long we keep attempting to send each item, is hard-coded and not changed by end users. While they are totally adequate for chasquid's main use cases, it can still be useful for some users to change them. So this patch adds two new configuration options for those settings. They're marked experimental for now, so we can adjust them if needed after they get more exposure. Thanks to Lewis Ross-Jones <lewis_r_j@hotmail.com> for suggesting this improvement, and help with testing it.
This commit is contained in:
@@ -58,6 +58,7 @@ func TestFullConfig(t *testing.T) {
|
||||
monitoring_address: ":1111"
|
||||
max_data_size_mb: 26
|
||||
suffix_separators: ""
|
||||
max_queue_items: 345
|
||||
`
|
||||
|
||||
tmpDir, path := mustCreateConfig(t, confStr)
|
||||
@@ -68,6 +69,7 @@ func TestFullConfig(t *testing.T) {
|
||||
submission_address: ":999"
|
||||
dovecot_auth: true
|
||||
drop_characters: ""
|
||||
give_up_send_after: "7h"
|
||||
`
|
||||
|
||||
expected := &Config{
|
||||
@@ -90,6 +92,9 @@ func TestFullConfig(t *testing.T) {
|
||||
MailLogPath: "<syslog>",
|
||||
|
||||
DovecotAuth: true,
|
||||
|
||||
MaxQueueItems: 345,
|
||||
GiveUpSendAfter: "7h",
|
||||
}
|
||||
|
||||
c, err := Load(path, overrideStr)
|
||||
@@ -134,6 +139,17 @@ func TestBrokenOverride(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestInvalidGiveUpSendingAfter(t *testing.T) {
|
||||
tmpDir, path := mustCreateConfig(
|
||||
t, `give_up_send_after: "10"`)
|
||||
defer testlib.RemoveIfOk(t, tmpDir)
|
||||
|
||||
c, err := Load(path, "")
|
||||
if err == nil {
|
||||
t.Fatalf("loaded an invalid config: %v", c)
|
||||
}
|
||||
}
|
||||
|
||||
// Run LogConfig, overriding the default logger first. This exercises the
|
||||
// code, we don't yet validate the output, but it is an useful sanity check.
|
||||
func testLogConfig(c *Config) {
|
||||
|
||||
Reference in New Issue
Block a user