forked from Archives/Athou_commafeed
add an additional day to make sure the timestamp fits in all timezones (#1239)
This commit is contained in:
@@ -25,6 +25,7 @@ import com.commafeed.backend.feed.parser.FeedParserResult.Entry;
|
||||
import com.commafeed.backend.model.Feed;
|
||||
import com.commafeed.backend.model.FeedEntry;
|
||||
import com.commafeed.backend.model.FeedSubscription;
|
||||
import com.commafeed.backend.model.Models;
|
||||
import com.commafeed.backend.model.User;
|
||||
import com.commafeed.backend.service.FeedEntryService;
|
||||
import com.commafeed.backend.service.FeedService;
|
||||
@@ -177,7 +178,7 @@ public class FeedRefreshUpdater {
|
||||
|
||||
if (!processed) {
|
||||
// requeue asap
|
||||
feed.setDisabledUntil(Feed.MINIMUM_DISABLED_UNTIL);
|
||||
feed.setDisabledUntil(Models.MINIMUM_INSTANT);
|
||||
}
|
||||
|
||||
if (inserted > 0) {
|
||||
|
||||
@@ -15,9 +15,6 @@ import lombok.Setter;
|
||||
@Setter
|
||||
public class Feed extends AbstractModel {
|
||||
|
||||
// mariadb timestamp range starts at 1970-01-01 00:00:01
|
||||
public static final Instant MINIMUM_DISABLED_UNTIL = Instant.EPOCH.plusSeconds(1);
|
||||
|
||||
/**
|
||||
* The url of the feed
|
||||
*/
|
||||
|
||||
@@ -1,12 +1,24 @@
|
||||
package com.commafeed.backend.model;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
|
||||
import org.hibernate.Hibernate;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.proxy.HibernateProxy;
|
||||
import org.hibernate.proxy.LazyInitializer;
|
||||
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
@UtilityClass
|
||||
public class Models {
|
||||
|
||||
public static final Instant MINIMUM_INSTANT = Instant.EPOCH
|
||||
// mariadb timestamp range starts at 1970-01-01 00:00:01
|
||||
.plusSeconds(1)
|
||||
// make sure the timestamp fits for all timezones
|
||||
.plus(Duration.ofHours(24));
|
||||
|
||||
/**
|
||||
* initialize a proxy
|
||||
*/
|
||||
@@ -18,8 +30,8 @@ public class Models {
|
||||
* extract the id from the proxy without initializing it
|
||||
*/
|
||||
public static Long getId(AbstractModel model) {
|
||||
if (model instanceof HibernateProxy) {
|
||||
LazyInitializer lazyInitializer = ((HibernateProxy) model).getHibernateLazyInitializer();
|
||||
if (model instanceof HibernateProxy proxy) {
|
||||
LazyInitializer lazyInitializer = proxy.getHibernateLazyInitializer();
|
||||
if (lazyInitializer.isUninitialized()) {
|
||||
return (Long) lazyInitializer.getIdentifier();
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.commafeed.backend.favicon.AbstractFaviconFetcher;
|
||||
import com.commafeed.backend.favicon.Favicon;
|
||||
import com.commafeed.backend.feed.FeedUtils;
|
||||
import com.commafeed.backend.model.Feed;
|
||||
import com.commafeed.backend.model.Models;
|
||||
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.inject.Singleton;
|
||||
@@ -45,7 +46,7 @@ public class FeedService {
|
||||
feed.setUrl(url);
|
||||
feed.setNormalizedUrl(normalizedUrl);
|
||||
feed.setNormalizedUrlHash(normalizedUrlHash);
|
||||
feed.setDisabledUntil(Feed.MINIMUM_DISABLED_UNTIL);
|
||||
feed.setDisabledUntil(Models.MINIMUM_INSTANT);
|
||||
feedDAO.saveOrUpdate(feed);
|
||||
}
|
||||
return feed;
|
||||
|
||||
Reference in New Issue
Block a user