webui v143: the channel list never refreshed, and three different periods

The scope predicate of the channel list background task was entirely commented
out, so it returned undefined: setBackgroundTask stopped after the first
interval and the list was loaded once, never refreshed while the page stayed
open. It now tests the route like the boards one does.

The three group lists polled at three different periods: forums every 5 s,
boards every 30 s, channels never. Each poll fetches the whole summaries list,
and on a phone it costs a fresh TCP handshake on a server that answers one
request at a time. All three now share the boards period, named per page.
This commit is contained in:
jolavillette 2026-08-16 13:06:50 +02:00
parent 543a65f210
commit 6b988dffa8
4 changed files with 24 additions and 7 deletions

View File

@ -36,6 +36,9 @@ const getBoards = {
},
};
// Group lists change on the scale of a conversation, not of a frame.
const BOARD_LIST_REFRESH_MS = 30000;
const sections = {
MyBoards: require('boards/my_boards'),
Subscribed: require('boards/subscribed_boards'),
@ -48,7 +51,7 @@ const Layout = () => {
return {
oninit: () => {
rs.setBackgroundTask(getBoards.load, 30000, () => {
rs.setBackgroundTask(getBoards.load, BOARD_LIST_REFRESH_MS, () => {
return m.route.get().startsWith('/boards');
});
peopleUtil.ownIds((data) => {

View File

@ -40,6 +40,9 @@ const getChannels = {
},
};
// Group lists change on the scale of a conversation, not of a frame.
const CHANNEL_LIST_REFRESH_MS = 30000;
const sections = {
MyChannels: require('channels/my_channels'),
Subscribed: require('channels/subscribed_channels'),
@ -52,9 +55,14 @@ const Layout = () => {
return {
oninit: () => {
rs.setBackgroundTask(getChannels.load, 5000, () => {
// return m.route.get() === '/files/files';
});
// The scope predicate used to be commented out, so it returned undefined
// and setBackgroundTask stopped after the first interval: the channel list
// was loaded once and never refreshed while the page stayed open. Same
// period as the boards list, which asks the same kind of question -- a
// five second poll of a whole summaries list is a lot to pay on a phone.
rs.setBackgroundTask(getChannels.load, CHANNEL_LIST_REFRESH_MS, () =>
m.route.get().startsWith('/channels')
);
peopleUtil.ownIds((data) => {
ownId = data;
for (let i = 0; i < ownId.length; i++) {

View File

@ -26,6 +26,9 @@ const getForums = {
}
},
};
// Group lists change on the scale of a conversation, not of a frame.
const FORUM_LIST_REFRESH_MS = 30000;
const sections = {
MyForums: require('forums/my_forums'),
Subscribed: require('forums/subscribed_forums'),
@ -38,7 +41,10 @@ const Layout = () => {
return {
oninit: () => {
rs.setBackgroundTask(getForums.load, 5000, () => {
// Was every 5 s. getForumsSummaries returns the whole list every time,
// and on a phone each poll is a fresh TCP handshake on a server that
// answers one request at a time; the boards list already settled on 30 s.
rs.setBackgroundTask(getForums.load, FORUM_LIST_REFRESH_MS, () => {
return m.route.get().includes('/forums');
});
peopleUtil.ownIds((data) => {

View File

@ -114,7 +114,7 @@ const navbar = () => {
? 'Connected to RetroShare Core'
: 'Connection Lost',
}),
m('span.webui-version', { style: { fontSize: '0.7em' } }, 'v142'),
m('span.webui-version', { style: { fontSize: '0.7em' } }, 'v143'),
m('i.fas.fa-sync-alt.refresh-icon', {
style: { cursor: 'pointer', fontSize: '0.8em' },
onclick: () => window.location.reload(true),
@ -236,7 +236,7 @@ const MobileStatus = () => {
m('small', statusbar.formatBytes(state.totalOut)),
]),
]),
m('.mobile-status-sheet__version', 'WebUI v142'),
m('.mobile-status-sheet__version', 'WebUI v143'),
])),
];
},