Skip to content

Commit

Permalink
Use ISO representation of time for discoveryDate and lastProcessedDate,
Browse files Browse the repository at this point in the history
fixes #477
  • Loading branch information
jnioche committed Jun 13, 2017
1 parent f0c3f21 commit 8009878
Showing 1 changed file with 3 additions and 7 deletions.
Expand Up @@ -16,8 +16,7 @@
*/
package com.digitalpebble.stormcrawler.persistence;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
Expand Down Expand Up @@ -50,9 +49,6 @@ public abstract class AbstractStatusUpdaterBolt extends BaseRichBolt {
private static final Logger LOG = LoggerFactory
.getLogger(AbstractStatusUpdaterBolt.class);

private static final DateFormat dateFormat = new SimpleDateFormat(
"yyyy-MM-dd'T'HH:mm:ss");

/**
* Parameter name to indicate whether the internal cache should be used for
* discovered URLs. The value of the parameter is a boolean - true by
Expand Down Expand Up @@ -145,8 +141,8 @@ public void execute(Tuple tuple) {

Metadata metadata = (Metadata) tuple.getValueByField("metadata");

// store last processed or discovery date
final String nowAsString = dateFormat.format(new Date());
// store last processed or discovery date in UTC
final String nowAsString = Instant.now().toString();
if (status.equals(Status.DISCOVERED)) {
metadata.setValue("discoveryDate", nowAsString);
} else {
Expand Down

0 comments on commit 8009878

Please sign in to comment.