forked from Archives/Athou_commafeed
queue feed for refresh after a subscription
This commit is contained in:
@@ -37,6 +37,13 @@ public class FeedRefreshTaskGiver {
|
|||||||
.getBackgroundThreads();
|
.getBackgroundThreads();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Lock(LockType.WRITE)
|
||||||
|
public void add(Feed feed) {
|
||||||
|
queue.add(feed);
|
||||||
|
feed.setLastUpdated(Calendar.getInstance().getTime());
|
||||||
|
feedDAO.update(feed);
|
||||||
|
}
|
||||||
|
|
||||||
@Lock(LockType.WRITE)
|
@Lock(LockType.WRITE)
|
||||||
public Feed take() {
|
public Feed take() {
|
||||||
Feed feed = queue.poll();
|
Feed feed = queue.poll();
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import javax.inject.Inject;
|
|||||||
import com.commafeed.backend.dao.FeedEntryDAO;
|
import com.commafeed.backend.dao.FeedEntryDAO;
|
||||||
import com.commafeed.backend.dao.FeedEntryStatusDAO;
|
import com.commafeed.backend.dao.FeedEntryStatusDAO;
|
||||||
import com.commafeed.backend.dao.FeedSubscriptionDAO;
|
import com.commafeed.backend.dao.FeedSubscriptionDAO;
|
||||||
|
import com.commafeed.backend.feeds.FeedRefreshTaskGiver;
|
||||||
import com.commafeed.backend.model.Feed;
|
import com.commafeed.backend.model.Feed;
|
||||||
import com.commafeed.backend.model.FeedCategory;
|
import com.commafeed.backend.model.FeedCategory;
|
||||||
import com.commafeed.backend.model.FeedEntry;
|
import com.commafeed.backend.model.FeedEntry;
|
||||||
@@ -31,6 +32,8 @@ public class FeedSubscriptionService {
|
|||||||
@Inject
|
@Inject
|
||||||
FeedSubscriptionDAO feedSubscriptionDAO;
|
FeedSubscriptionDAO feedSubscriptionDAO;
|
||||||
|
|
||||||
|
@Inject FeedRefreshTaskGiver taskGiver;
|
||||||
|
|
||||||
public Feed subscribe(User user, String url, String title,
|
public Feed subscribe(User user, String url, String title,
|
||||||
FeedCategory category) {
|
FeedCategory category) {
|
||||||
|
|
||||||
@@ -60,6 +63,7 @@ public class FeedSubscriptionService {
|
|||||||
}
|
}
|
||||||
feedEntryStatusDAO.save(statuses);
|
feedEntryStatusDAO.save(statuses);
|
||||||
}
|
}
|
||||||
|
taskGiver.add(feed);
|
||||||
return feed;
|
return feed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user