You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,6 +32,7 @@
32
32
- Add the ability to use local Woff2 fonts in the [shell](https://sql.ophir.dev/documentation.sql?component=shell#component) component. This is useful to use custom fonts in your website, without depending on google fonts (and disclosing your users' IP addresses to google).
33
33
- Add a `fixed_top_menu` attribute to make the top menu sticky. This is useful to keep the menu visible even when the user scrolls down the page.
34
34
- Add a `wrap` attribute to the `list` component to wrap items on multiple lines when they are too long.
35
+
- New `max_pending_rows` [configuration option](https://sql.ophir.dev/configuration.md) to limit the number of messages that can be sent to the client before they are read. Usefule when sending large amounts of data to slow clients.
Copy file name to clipboardExpand all lines: configuration.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,7 @@ Here are the available configuration options and their default values:
23
23
|`configuration_directory`|`./sqlpage/`| The directory where the `sqlpage.json` file is located. This is used to find the path to [`templates/`](https://sql.ophir.dev/custom_components.sql), [`migrations/`](https://sql.ophir.dev/your-first-sql-website/migrations.sql), and `on_connect.sql`. Obviously, this configuration parameter can be set only through environment variables, not through the `sqlpage.json` file itself in order to find the `sqlpage.json` file. Be careful not to use a path that is accessible from the public WEB_ROOT |
24
24
|`allow_exec`| false | Allow usage of the `sqlpage.exec` function. Do this only if all users with write access to sqlpage query files and to the optional `sqlpage_files` table on the database are trusted. |
25
25
|`max_uploaded_file_size`| 5242880 | Maximum size of uploaded files in bytes. Defaults to 5 MiB. |
26
+
|`max_pending_rows`| 256 | Maximum number of rendered rows that can be queued up in memory when a client is slow to receive them. |
26
27
|`https_domain`|| Domain name to request a certificate for. Setting this parameter will automatically make SQLPage listen on port 443 and request an SSL certificate. The server will take a little bit longer to start the first time it has to request a certificate. |
27
28
|`https_certificate_email`| contact@<https_domain> | The email address to use when requesting a certificate. |
28
29
|`https_certificate_cache_dir`| ./sqlpage/https | A writeable directory where to cache the certificates, so that SQLPage can serve https traffic immediately when it restarts. |
Copy file name to clipboardExpand all lines: src/webserver/http.rs
+5-4Lines changed: 5 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -32,7 +32,6 @@ use tokio::sync::mpsc;
32
32
33
33
/// If the sending queue exceeds this number of outgoing messages, an error will be thrown
34
34
/// This prevents a single request from using up all available memory
35
-
constMAX_PENDING_MESSAGES:usize = 128;
36
35
37
36
#[derive(Clone)]
38
37
pubstructResponseWriter{
@@ -76,9 +75,10 @@ impl ResponseWriter {
76
75
.await
77
76
.map_err(|err| {
78
77
use std::io::{Error,ErrorKind};
78
+
let capacity = self.response_bytes.capacity();
79
79
Error::new(
80
80
ErrorKind::BrokenPipe,
81
-
format!("The HTTP response writer with a capacity of {MAX_PENDING_MESSAGES} has already been closed: {err}"),
81
+
format!("The HTTP response writer with a capacity of {capacity} has already been closed: {err}"),
82
82
)
83
83
})
84
84
}
@@ -96,7 +96,7 @@ impl Write for ResponseWriter {
96
96
.map_err(|e|
97
97
std::io::Error::new(
98
98
std::io::ErrorKind::WouldBlock,
99
-
format!("{e}: Database messages limit exceeded. The server cannot store more than {} pending messages in memory.",self.response_bytes.capacity())
99
+
format!("{e}: Row limit exceeded. The server cannot store more than {} pending messages in memory. Try again later or increase max_pending_rows in the configuration.",self.response_bytes.max_capacity())
0 commit comments