Skip to content

Commit

Permalink
chore: add Event constructor to avoid random uuid call (#170)
Browse files Browse the repository at this point in the history
  • Loading branch information
iProdigy authored Jun 28, 2023
1 parent 4bd52b5 commit e310e78
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,18 @@ public abstract class Event implements IEvent {
* Constructor
*/
public Event() {
eventId = UUID.randomUUID().toString();
firedAtInstant = Instant.now();
this(UUID.randomUUID().toString(), Instant.now());
}

/**
* Constructor
*
* @param eventId Unique event id
* @param firedAt Timestamp of the event firing
*/
public Event(String eventId, Instant firedAt) {
this.eventId = eventId;
this.firedAtInstant = firedAt;
}

@Override
Expand Down

0 comments on commit e310e78

Please sign in to comment.