Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Commit

Permalink
feature: Replace currenttimemillis by a smaller random number
Browse files Browse the repository at this point in the history
  • Loading branch information
Delawen committed Jun 28, 2023
1 parent c71a8e2 commit f9c6401
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Random;

/**
* 🐱class IntegrationsResource
Expand Down Expand Up @@ -146,12 +147,14 @@ private static void ensureUniqueNames(FlowsWrapper answer) {
}
//Make sure there is an id/name assigned to all flows
if (!flow.getMetadata().containsKey(name)) {
Random random = new Random();
flow.getMetadata().put(name,
flow.getDsl().toLowerCase().replaceAll(" ", "") + System.currentTimeMillis());
flow.getDsl().toLowerCase().replaceAll(" ", "") + random.nextInt(99));
}
//Make sure it is unique
if (usedIds.contains(flow.getMetadata().get(name))) {
flow.getMetadata().put(name, String.valueOf(flow.getMetadata().get(name)) + System.currentTimeMillis());
Random random = new Random();
flow.getMetadata().put(name, String.valueOf(flow.getMetadata().get(name)) + random.nextInt(99));
}
usedIds.add(String.valueOf(flow.getMetadata().get(name)));
}
Expand Down

0 comments on commit f9c6401

Please sign in to comment.