-
Hi, I have a Regarding to the logs I would have expected that every separate execution of the Instead all the runs are collected into one The funny thing: Somehow the same code produces multiple Log__c records within the Sandbox. I do not understand how they are related at all as every separate Does anybody have a hint how this could happen or what I might be doing wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 7 replies
-
Hi @reitffunk - that definitely looks like a bug, each execution of the queueable job should have its own public without sharing class Chained_Queueable_Logger_Example implements Queueable {
private Integer numberOfJobsToChain;
private String parentLogTransactionId;
private List<LogEntryEvent__e> logEntryEvents = new List<LogEntryEvent__e>();
public Chained_Queueable_Logger_Example(Integer numberOfJobsToChain) {
this(numberOfJobsToChain, null);
}
private Chained_Queueable_Logger_Example(Integer numberOfJobsToChain, String parentLogTransactionId) {
this.numberOfJobsToChain = numberOfJobsToChain;
this.parentLogTransactionId = parentLogTransactionId;
}
public void execute(System.QueueableContext queueableContext) {
Logger.setParentLogTransactionId(this.parentLogTransactionId);
Logger.fine('queueableContext==' + queueableContext);
Logger.info('this.numberOfJobsToChain==' + this.numberOfJobsToChain);
Logger.info('this.parentLogTransactionId==' + this.parentLogTransactionId);
Logger.saveLog();
--this.numberOfJobsToChain;
if (this.numberOfJobsToChain > 0) {
String parentLogTransactionId = this.parentLogTransactionId != null ? this.parentLogTransactionId : Logger.getTransactionId();
System.enqueueJob(new Account_Queueable_Logger_Example(this.numberOfJobsToChain, parentLogTransactionId));
}
}
} |
Beta Was this translation helpful? Give feedback.
-
Hi @jongpie, thanks for testing it directly. Following an observation and some code. Different transaction id prefixFirst weird thing is that the behavior differs from the Partial-Copy-Sandbox to the Production system. The Logger-Settings are the same and only one "Organization" record exists. Save method ist I just have noticed that the Transaction ID prefix differs for both systems. The "wrong" ones are prefixed with The triggering action comes from an Aura-Component, it is prefixed with Production-System (unexpected behavior): Partial-Copy-Sandbox (expected behavior) (ignore LOG-24, thats another platform event that is logged in this whole process): CodeNow some code, I strip any other logic to focus on triggering the Queueable and the Logger. Coming from the Aura-Component:
The UpdateCounterQueueable() chains itself:
Maybe the surround |
Beta Was this translation helpful? Give feedback.
-
Just noting that this was fixed in v4.7.3 by switching to always using a |
Beta Was this translation helpful? Give feedback.
Just noting that this was fixed in v4.7.3 by switching to always using a
UUID
for the transaction ID.