Module: Eco::API::UseCases::GraphQL::Samples::Location::Command::Service::TreeUpdate::InstanceMethods

Defined in:
lib/eco/api/usecases/graphql/samples/location/command/service/tree_update.rb

Instance Method Summary collapse

Instance Method Details

#processObject



19
20
21
22
23
24
25
26
# File 'lib/eco/api/usecases/graphql/samples/location/command/service/tree_update.rb', line 19

def process
  with_error_handling do
    super
  end
ensure
  rescued { re_archive } unless exception?
  rescued { email_digest('TagTree Update') }
end

#re_archiveObject

Note:

this is an additional necessary step

Before closing, run RE-ARCHIVE: those that where unarchived via archivedToken that should remain archived.



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/eco/api/usecases/graphql/samples/location/command/service/tree_update.rb', line 31

def re_archive
  return if simulate?
  return if exception?

  stage = :rearchive

  nodes_diff_class.new(
    hash_list(current_tree),
    file_nodes_list,
    original_tree: current_tree,
    logger:        logger
  ).tap do |nodes_diff|
    archive_input = input(nodes_diff.stage_commands(:archive), force_continue: true)
    sliced_batches(
      archive_input,
      desc:            stage,
      track_tree_mode: :once
    ) do |sliced_input, response, page, pages, count, total| # rubocop:disable Metrics/ParameterLists
      page_results = request_results_class.new(sliced_input, response)
      (results[stage] ||= []) << page_results
      self.error ||= page_errors?(page_results, page, pages, count, total, stage: stage)
    end
  end
end