In some applications, mainly Salesbutler, we have the problem that the whole log is flooded with:
[WARNING] Can't enable LHS::RequestCycleCache as LHC::Caching interceptor is not enabled/configured (see https://github.com/local-ch/lhc/blob/master/docs/interceptors/caching.md#caching-interceptor)!
While this warning is actually accurate, the RequestCycleCache is partially not active, which means we loose the benefit of caching the same requests during one request cycle!
The reason why the request cycle cache is partially not working, in this scenario, is the following:
In some applications, mainly Salesbutler, we have the problem that the whole log is flooded with:
While this warning is actually accurate, the RequestCycleCache is partially not active, which means we loose the benefit of caching the same requests during one request cycle!
The reason why the request cycle cache is partially not working, in this scenario, is the following:
Application makes request using LHS includes: https://github.com/local-ch/sales-butler/blob/master/app/models/customer.rb#L139
LHS includes (auto-loads) additional linked resources: https://github.com/local-ch/lhs/blob/has-many-options/lib/lhs/concerns/record/request.rb#L262
When loading batches, LHS
deep_dup
options when continue loading batches, to not mess with passed original options, which usually is not the problem: https://github.com/local-ch/lhs/blob/has-many-options/lib/lhs/concerns/record/request.rb#L436But in the context of the request cycle cache, it's checked if the
LHC::Caching
interceptor is part of the request options: https://github.com/local-ch/lhs/blob/has-many-options/lib/lhs/concerns/record/request.rb#L461Which is usually fine:
But because it's
deep_dup
ed during LHSinclude
the interceptor class itself has beendup
ed:Which makes the check if the
LHC::Caching
interceptor is included, fail:https://github.com/local-ch/lhs/blob/has-many-options/lib/lhs/concerns/record/request.rb#L461
As the Interceptor classes have flag-character itself, there is no reason to allow duplicating the class itself (everything is an object in ruby).
This PR disallows duplicating interceptor classes.