Conversation
|
I should be able to look into it by tomorrow. |
|
Thanks for checking it out. It should be fixed now. The add source button not functioning was caused by forgetting to call I also had to fix the |
|
With offline storage enabled, the client does not chain load items and stops after |
|
And then it seems to load the same entries over and over again. |
|
I I shut down the server, it keeps the ajax requests unfinished although the "Connection refused" should terminate them immediately. |
|
If I manually trigger |
|
when |
|
That seems to be true here but no luck. |
|
I would try the following but I'm stuck with a bundler error. --- a/assets/js/selfoss-db.js
+++ b/assets/js/selfoss-db.js
@@ -157,16 +157,19 @@ selfoss.dbOnline = {
selfoss.dbOffline.storeEntries(data.newItems)
.then(function() {
selfoss.dbOffline.storeLastUpdate(dataDate);
-
selfoss.dbOnline._syncDone();
-
- // fetch more if server has more
- if (selfoss.dbOffline.newerEntriesMissing) {
- selfoss.dbOnline.sync();
- }
});
}
+ if (selfoss.dbOffline.newerEntriesMissing
+ || selfoss.dbOffline.needsSync) {
+ // There are still new items to fetch
+ // or statuses to send
+ syncing.request.promise.then(function () {
+ selfoss.dbOffline.sendNewStatuses();
+ });
+ }
+
if ('itemUpdates' in data) {
// refresh entry statuses in db and dequeue queued
// statuses but do not calculate stats as they are taken |
|
Yeah, the bundlers are somewhat finicky in my experience. If I do That seems to work with a minor tweak: --- a/assets/js/selfoss-db.js
+++ b/assets/js/selfoss-db.js
@@ -159,14 +159,18 @@ selfoss.dbOnline = {
selfoss.dbOffline.storeLastUpdate(dataDate);
selfoss.dbOnline._syncDone();
-
- // fetch more if server has more
- if (selfoss.dbOffline.newerEntriesMissing) {
- selfoss.dbOnline.sync();
- }
});
}
+ if (selfoss.dbOffline.newerEntriesMissing
+ || selfoss.dbOffline.needsSync) {
+ // There are still new items to fetch
+ // or statuses to send
+ selfoss.dbOnline.syncing.request.promise.then(function () {
+ selfoss.dbOffline.sendNewStatuses();
+ });
+ }
+
if ('itemUpdates' in data) {
// refresh entry statuses in db and dequeue queued
// statuses but do not calculate stats as they are takenThanks. |
|
But that patch triggers a sync loop you mention, the last page does not seem to get picked up:
|
|
The sync loop seems to be specific to sqlite and how we compare dates as simple strings. We should either use specific syntax for sqlite queries or ensure compared dates share the same timezone. For instance, the following seems to be fixing the problem. --- a/src/controllers/Items/Sync.php
+++ b/src/controllers/Items/Sync.php
@@ -56,11 +56,12 @@ class Sync {
}
$since = new \DateTime($params['since']);
+ $since->setTimeZone(new \DateTimeZone(date_default_timezone_get()));
$last_update = new \DateTime($this->itemsDao->lastUpdate());
$sync = [
- 'lastUpdate' => $last_update->format('Y-m-d H:i:s'),
+ 'lastUpdate' => $last_update->format(\DateTime::ATOM),
];
$sinceId = 0;
@@ -73,6 +74,7 @@ class Sync {
// only send 1 day worth of items
$notBefore = new \DateTime();
$notBefore->sub(new \DateInterval('P1D'));
+ $notBefore->->setTimeZone(new \DateTimeZone(date_default_timezone_get()));
}
$itemsHowMany = $f3->get('items_perpage'); |
This will bring us one step closer to removing jQuery. Unfortunately the native promises lack built-in support for aborting so we need to clumsily return AbortController alongside them.
So that `then` handlers only fire on success and we can attach `catch` handlers to it.
This will bring us one step closer to removing jQuery.
Unfortunately the native promises lack built-in support for aborting so we need to somewhat clumsily return
AbortControlleralongside them.While at it, I also got rid of the jQuery Deferreds so the only remaining use of jQuery is the DOM manipulation. Hopefully, it will not remain for long.