mirror of
https://github.com/yacy/yacy_search_server.git
synced 2026-10-25 05:54:15 +00:00
fix for event starter: delete start time when event is removed
This commit is contained in:
1 parent
99271ffd13
commit
9e4033f229
3 files changed
+10
-2
No files matched your search
@@ -93,7 +93,10 @@ public class Table_API_p {
|
||||
}
|
||||
|
||||
if (post.containsKey("event_kind_" + current_pk) ) {
|
||||
row.put(WorkTables.TABLE_API_COL_APICALL_EVENT_KIND, post.get("event_kind_" + current_pk, "off"));
|
||||
if ("off".equals(action = post.get("event_kind_" + current_pk, "off"))) {
|
||||
row.put(WorkTables.TABLE_API_COL_DATE_NEXT_EXEC, "");
|
||||
}
|
||||
row.put(WorkTables.TABLE_API_COL_APICALL_EVENT_KIND, action);
|
||||
}
|
||||
|
||||
if (post.containsKey("event_action_" + current_pk) ) {
|
||||
|
||||
@@ -292,6 +292,7 @@ public class WorkTables extends Tables {
|
||||
public static void calculateAPIScheduler(Tables.Data row, boolean update) {
|
||||
Date date = row.containsKey(WorkTables.TABLE_API_COL_DATE) ? row.get(WorkTables.TABLE_API_COL_DATE, (Date) null) : null;
|
||||
date = update ? row.get(WorkTables.TABLE_API_COL_DATE_NEXT_EXEC, date) : row.get(WorkTables.TABLE_API_COL_DATE_LAST_EXEC, date);
|
||||
if (date == null) return;
|
||||
long d = date.getTime();
|
||||
|
||||
final String kind = row.get(WorkTables.TABLE_API_COL_APICALL_EVENT_KIND, "off");
|
||||
@@ -313,7 +314,10 @@ public class WorkTables extends Tables {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmm");
|
||||
d = dateFormat.parse(dateFormat.format(new Date()).substring(0, 8) + action).getTime();
|
||||
if (d < System.currentTimeMillis()) d += day;
|
||||
} catch (ParseException e) {}
|
||||
} catch (ParseException e) {} else {
|
||||
row.put(WorkTables.TABLE_API_COL_DATE_NEXT_EXEC, "");
|
||||
return;
|
||||
}
|
||||
}
|
||||
row.put(WorkTables.TABLE_API_COL_DATE_NEXT_EXEC, new Date(d));
|
||||
}
|
||||
|
||||
@@ -2266,6 +2266,7 @@ public final class Switchboard extends serverSwitch {
|
||||
pks.add(UTF8.String(row.getPK()));
|
||||
if ("once".equals(kind)) {
|
||||
row.put(WorkTables.TABLE_API_COL_APICALL_EVENT_KIND, "off");
|
||||
row.put(WorkTables.TABLE_API_COL_DATE_NEXT_EXEC, "");
|
||||
sb.tables.update(WorkTables.TABLE_API_NAME, row);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user