2005-10-31 jrandom
* Fix for some syndie reply scenarios (thanks identiguy and CofE!) * Removed a potentially infinitely recursive call (oops)
This commit is contained in:
@ -13,24 +13,33 @@ public class Updater {
|
||||
private static final Log _log = I2PAppContext.getGlobalContext().logManager().getLog(Updater.class);
|
||||
private static final Updater _instance = new Updater();
|
||||
private long _lastUpdate;
|
||||
private static boolean _woken;
|
||||
|
||||
public void update() {
|
||||
BlogManager bm = BlogManager.instance();
|
||||
if (_lastUpdate + bm.getUpdateDelay()*60*60*1000 > System.currentTimeMillis()) {
|
||||
return;
|
||||
if (!_woken)
|
||||
return;
|
||||
}
|
||||
_lastUpdate = System.currentTimeMillis();
|
||||
_log.debug("Update started.");
|
||||
String[] archives = bm.getUpdateArchives();
|
||||
for (int i = 0; i < archives.length; i++) {
|
||||
_log.debug("Fetching " + archives[i]);
|
||||
fetchArchive(archives[i]);
|
||||
_log.debug("Done fetching " + archives[i]);
|
||||
}
|
||||
_log.debug("Done fetching archives");
|
||||
List rssFeeds = bm.getRssFeeds();
|
||||
Iterator iter = rssFeeds.iterator();
|
||||
while(iter.hasNext()) {
|
||||
Sucker sucker = new Sucker((String[])iter.next());
|
||||
String args[] = (String[])iter.next();
|
||||
_log.debug("rss feed begin: " + args[0]);
|
||||
Sucker sucker = new Sucker(args);
|
||||
sucker.suck();
|
||||
_log.debug("rss feed end: " + args[0]);
|
||||
}
|
||||
_log.debug("Done with all updating");
|
||||
}
|
||||
|
||||
public void fetchArchive(String archive) {
|
||||
@ -48,6 +57,7 @@ public class Updater {
|
||||
}
|
||||
|
||||
public static void main() {
|
||||
_woken = false;
|
||||
_instance.run();
|
||||
}
|
||||
|
||||
@ -55,7 +65,7 @@ public class Updater {
|
||||
|
||||
// wait
|
||||
try {
|
||||
Thread.currentThread().sleep(5*60*1000);
|
||||
Thread.currentThread().sleep(1*60*1000);
|
||||
} catch (InterruptedException ie) {}
|
||||
|
||||
while (true) {
|
||||
@ -63,6 +73,7 @@ public class Updater {
|
||||
update();
|
||||
try {
|
||||
synchronized (this) {
|
||||
_woken = false;
|
||||
wait(delay * 60 * 60 * 1000);
|
||||
}
|
||||
} catch (InterruptedException exp) {
|
||||
@ -73,6 +84,7 @@ public class Updater {
|
||||
|
||||
public static void wakeup() {
|
||||
synchronized (_instance) {
|
||||
_woken = true;
|
||||
_instance.notifyAll();
|
||||
}
|
||||
}
|
||||
|
@ -1027,8 +1027,10 @@ public class HTMLRenderer extends EventReceiverImpl {
|
||||
buf.append(ArchiveViewerBean.PARAM_PAGE_NUMBER).append('=').append(pageNum).append('&');
|
||||
buf.append(ArchiveViewerBean.PARAM_NUM_PER_PAGE).append('=').append(numPerPage).append('&');
|
||||
}
|
||||
buf.append(ArchiveViewerBean.PARAM_EXPAND_ENTRIES).append('=').append(user.getShowExpanded()).append('&');
|
||||
buf.append(ArchiveViewerBean.PARAM_SHOW_IMAGES).append('=').append(user.getShowImages()).append('&');
|
||||
if (user != null) {
|
||||
buf.append(ArchiveViewerBean.PARAM_EXPAND_ENTRIES).append('=').append(user.getShowExpanded()).append('&');
|
||||
buf.append(ArchiveViewerBean.PARAM_SHOW_IMAGES).append('=').append(user.getShowImages()).append('&');
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
|
@ -121,6 +121,10 @@ for (Iterator iter = names.iterator(); iter.hasNext(); ) {
|
||||
} else {
|
||||
// logged in and not confirmed because they didn't send us anything!
|
||||
// give 'em a new form
|
||||
|
||||
post.reinitialize();
|
||||
post.setUser(user);
|
||||
|
||||
String entrySubject = request.getParameter("replySubject");
|
||||
String entryTags = request.getParameter("replyTags");
|
||||
String parentURI = request.getParameter("parentURI");
|
||||
|
@ -1,4 +1,8 @@
|
||||
$Id: history.txt,v 1.309 2005/10/29 18:20:04 jrandom Exp $
|
||||
$Id: history.txt,v 1.310 2005/10/30 00:47:55 dust Exp $
|
||||
|
||||
2005-10-31 jrandom
|
||||
* Fix for some syndie reply scenarios (thanks identiguy and CofE!)
|
||||
* Removed a potentially infinitely recursive call (oops)
|
||||
|
||||
2005-10-30 dust
|
||||
* Merge sucker into syndie with a rssimport.jsp page.
|
||||
|
@ -36,7 +36,7 @@ public class FloodfillDatabaseLookupMessageHandler implements HandlerJobBuilder
|
||||
|
||||
if (true || _context.throttle().acceptNetDbLookupRequest(((DatabaseLookupMessage)receivedMessage).getSearchKey())) {
|
||||
Job j = new HandleFloodfillDatabaseLookupMessageJob(_context, (DatabaseLookupMessage)receivedMessage, from, fromHash);
|
||||
if (true) {
|
||||
if (false) {
|
||||
// might as well inline it, all the heavy lifting is queued up in later jobs, if necessary
|
||||
j.runJob();
|
||||
return null;
|
||||
|
@ -30,7 +30,7 @@ public class FloodfillDatabaseStoreMessageHandler implements HandlerJobBuilder {
|
||||
}
|
||||
public Job createJob(I2NPMessage receivedMessage, RouterIdentity from, Hash fromHash) {
|
||||
Job j = new HandleFloodfillDatabaseStoreMessageJob(_context, (DatabaseStoreMessage)receivedMessage, from, fromHash, _facade);
|
||||
if (true) {
|
||||
if (false) {
|
||||
j.runJob();
|
||||
return null;
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user