Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persistence #19

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open

Persistence #19

wants to merge 28 commits into from

Conversation

iloveitaly
Copy link
Contributor

@iloveitaly iloveitaly commented Apr 6, 2016

Initial audit log / persistence implementation.

Dependent PRs:

TODO

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

@mtylty
Copy link
Member

mtylty commented Jun 24, 2016

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

@iloveitaly
Copy link
Contributor Author

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

@bricesanchez
Copy link
Contributor

@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
Copy link
Contributor

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?

@iloveitaly
Copy link
Contributor Author

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

@@ -6,8 +6,7 @@

require 'cangaroo'

database_path = File.expand_path('../../../tmp/cangaroo_test.sqlite3', __FILE__)
ENV['DATABASE_URL'] = "sqlite3://#{database_path}"
ENV['DATABASE_URL'] = "postgres:///cangaroo_test"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

@iloveitaly
Copy link
Contributor Author

@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
Copy link
Contributor Author

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
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants