mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
remove feed/refresh rest endpoint as it's unused and does not honor the force-refresh-cooldown-duration setting (#1802)
This commit is contained in:
@@ -114,17 +114,6 @@ public class FeedSubscriptionService {
|
|||||||
user.setLastForceRefresh(Instant.now());
|
user.setLastForceRefresh(Instant.now());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refreshAllUpForRefresh(User user) {
|
|
||||||
List<FeedSubscription> subs = feedSubscriptionDAO.findAll(user);
|
|
||||||
for (FeedSubscription sub : subs) {
|
|
||||||
Instant disabledUntil = sub.getFeed().getDisabledUntil();
|
|
||||||
if (disabledUntil == null || disabledUntil.isBefore(Instant.now())) {
|
|
||||||
Feed feed = sub.getFeed();
|
|
||||||
feedRefreshEngine.refreshImmediately(feed);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<Long, UnreadCount> getUnreadCount(User user) {
|
public Map<Long, UnreadCount> getUnreadCount(User user) {
|
||||||
return feedSubscriptionDAO.findAll(user)
|
return feedSubscriptionDAO.findAll(user)
|
||||||
.stream()
|
.stream()
|
||||||
|
|||||||
@@ -286,24 +286,6 @@ public class FeedREST {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Path("/refresh")
|
|
||||||
@POST
|
|
||||||
@Transactional
|
|
||||||
@Operation(summary = "Queue a feed for refresh", description = "Manually add a feed to the refresh queue")
|
|
||||||
public Response queueForRefresh(@Parameter(description = "Feed id", required = true) IDRequest req) {
|
|
||||||
Preconditions.checkNotNull(req);
|
|
||||||
Preconditions.checkNotNull(req.getId());
|
|
||||||
|
|
||||||
User user = authenticationContext.getCurrentUser();
|
|
||||||
FeedSubscription sub = feedSubscriptionDAO.findById(user, req.getId());
|
|
||||||
if (sub != null) {
|
|
||||||
Feed feed = sub.getFeed();
|
|
||||||
feedRefreshEngine.refreshImmediately(feed);
|
|
||||||
return Response.ok().build();
|
|
||||||
}
|
|
||||||
return Response.ok(Status.NOT_FOUND).build();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Path("/mark")
|
@Path("/mark")
|
||||||
@POST
|
@POST
|
||||||
@Transactional
|
@Transactional
|
||||||
|
|||||||
@@ -163,26 +163,6 @@ class FeedIT extends BaseIT {
|
|||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
class Refresh {
|
class Refresh {
|
||||||
@Test
|
|
||||||
void refresh() {
|
|
||||||
Long subscriptionId = subscribeAndWaitForEntries(getFeedUrl());
|
|
||||||
|
|
||||||
// mariadb/mysql timestamp precision is 1 second
|
|
||||||
Instant threshold = Instant.now().minus(Duration.ofSeconds(1));
|
|
||||||
|
|
||||||
IDRequest request = new IDRequest();
|
|
||||||
request.setId(subscriptionId);
|
|
||||||
RestAssured.given()
|
|
||||||
.body(request)
|
|
||||||
.contentType(MediaType.APPLICATION_JSON)
|
|
||||||
.post("rest/feed/refresh")
|
|
||||||
.then()
|
|
||||||
.statusCode(HttpStatus.SC_OK);
|
|
||||||
|
|
||||||
Awaitility.await()
|
|
||||||
.atMost(Duration.ofSeconds(15))
|
|
||||||
.until(() -> getSubscription(subscriptionId), f -> f.getLastRefresh().isAfter(threshold));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void refreshAll() {
|
void refreshAll() {
|
||||||
|
|||||||
Reference in New Issue
Block a user