Skip to content

Commit

Permalink
Delay load the net-scp require to avoid bloating eager loading
Browse files Browse the repository at this point in the history
require net/scp seems to be around 5 MB of memory and requires 122 files:
  0  <+  net/scp (0.236512) (5308416) (122)

If we ever are to eager load plugins, we need to avoid having them requiring client
code at code load time.
  • Loading branch information
jrafanie committed May 6, 2024
1 parent e4360ed commit a092ed7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/manageiq/providers/amazon/agent_coordinator.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
require 'yaml'
require 'open3'
require 'net/scp'
require 'tempfile'
require 'linux_admin'
require 'awesome_spawn'
Expand Down Expand Up @@ -148,6 +147,7 @@ def ssa_queue
private

def scp_file(ip, username, auth_key, local_file, remote_file)
require 'net/scp'
Net::SCP.upload!(ip, username, local_file, remote_file, :ssh => {:key_data => auth_key})
rescue => err
_log.error(err.message)
Expand Down

0 comments on commit a092ed7

Please sign in to comment.