cangaroo icon indicating copy to clipboard operation
cangaroo copied to clipboard

Persistence

Open iloveitaly opened this issue 8 years ago • 8 comments

Initial audit log / persistence implementation.

Dependent PRs:

  • https://github.com/nebulab/cangaroo/pull/34
  • https://github.com/nebulab/cangaroo/pull/30
  • https://github.com/nebulab/cangaroo/pull/25

TODO

  • [ ] specs for attempts
  • [ ] response includes the root keys right now. Consider if this is the best approach
  • [x] think on polljob logging
  • [x] think on logging transformation + request params in attempt

iloveitaly avatar Apr 06 '16 01:04 iloveitaly

@iloveitaly could you please rebase this on the master branch?

mtylty avatar Jun 24 '16 15:06 mtylty

@mtylty slammed with other work at the moment, I'll get to this within 1-2 weeks.

iloveitaly avatar Jun 25 '16 21:06 iloveitaly

@iloveitaly Is the goal of this PR to provide a Translation table to keep source and destination ids of record ?

Like my warehouse product ID is 1 and the shopify ID is 60001 and this PR will add the feature to keep id 1 and 60001 ?

bricesanchez avatar Jul 05 '16 19:07 bricesanchez

It is probably more a feature to persist an unfinished job !? Like if one integration is down, it will retry to send the response until it works?

bricesanchez avatar Jul 06 '16 13:07 bricesanchez

It is probably more a feature to persist an unfinished job !? Like if one integration is down, it will retry to send the response until it works?

Not exactly. Here's some more information about the goals here

  • Persist an unfinished or finished job
  • If job is unfinished or failed, response == nil
  • If job is finished, response payload is persisted
  • Each attempt to push job to service is logged as an Attempt
  • Persisting a job with the primary key on the object enables you to determine if a payload is new or updated[0]

[0]

def perform?
  type == 'shipment' && self.payload_state == :new
end

cc @AlessioRocco

iloveitaly avatar Aug 19 '16 10:08 iloveitaly

@mtylty Rebased this PR on master, but it's dependent on the other smaller PRs I have open. Those will need to be merged before this passes.

Looking forward to hearing your thoughts!

iloveitaly avatar Aug 19 '16 11:08 iloveitaly

An example of what the Translation class allows for:

def perform?
  self.unique_state?
end

def unique_state?
  !self.
    translation.
    related_translations.
    map { |t| t.request['status'] }.
    uniq.
    include? self.payload['status']
end

iloveitaly avatar Sep 06 '16 01:09 iloveitaly

@AlessioRocco Any thoughts on this? I can rebase this PR if you have time to dig in.

iloveitaly avatar Apr 16 '17 17:04 iloveitaly