Commit 458beede1a0cb614307525e2781c2f01a0f9d104

Authored by Andrii Shvaika
1 parent 3869f9f2

Default Storage TTL in Days

... ... @@ -45,6 +45,8 @@ public class DefaultTenantProfileConfiguration implements TenantProfileConfigura
45 45 private long maxEmails;
46 46 private long maxSms;
47 47
  48 + private int defaultStorageTtlDays;
  49 +
48 50 private double warnThreshold;
49 51
50 52 @Override
... ...
... ... @@ -50,10 +50,12 @@ import java.util.Map;
50 50 public class TbMsgTimeseriesNode implements TbNode {
51 51
52 52 private TbMsgTimeseriesNodeConfiguration config;
  53 + private long tenantProfileDefaultStorageTtl;
53 54
54 55 @Override
55 56 public void init(TbContext ctx, TbNodeConfiguration configuration) throws TbNodeException {
56 57 this.config = TbNodeUtils.convert(configuration, TbMsgTimeseriesNodeConfiguration.class);
  58 +
57 59 }
58 60
59 61 @Override
... ... @@ -77,6 +79,9 @@ public class TbMsgTimeseriesNode implements TbNode {
77 79 }
78 80 String ttlValue = msg.getMetaData().getValue("TTL");
79 81 long ttl = !StringUtils.isEmpty(ttlValue) ? Long.parseLong(ttlValue) : config.getDefaultTTL();
  82 + if (ttl == 0L) {
  83 + ttl = tenantProfileDefaultStorageTtl;
  84 + }
80 85 ctx.getTelemetryService().saveAndNotify(ctx.getTenantId(), msg.getOriginator(), tsKvEntryList, ttl, new TelemetryNodeCallback(ctx, msg));
81 86 }
82 87
... ...