mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
fix: keep alive long running sftp connections
This commit is contained in:
parent
6b75af4c7d
commit
aa39303dfc
2 changed files with 2 additions and 2 deletions
|
|
@ -6,7 +6,7 @@ module Sftp
|
||||||
def self.open(path: '/data/survey_responses/clean', &block)
|
def self.open(path: '/data/survey_responses/clean', &block)
|
||||||
sftp_url = ENV['SFTP_URL']
|
sftp_url = ENV['SFTP_URL']
|
||||||
uri = URI.parse(sftp_url)
|
uri = URI.parse(sftp_url)
|
||||||
Net::SFTP.start(uri.host, uri.user, password: uri.password) do |sftp|
|
Net::SFTP.start(uri.host, uri.user, password: uri.password, keepalive: true, keepalive_interval: 5) do |sftp|
|
||||||
sftp.dir.foreach(path) do |entry|
|
sftp.dir.foreach(path) do |entry|
|
||||||
next unless entry.file?
|
next unless entry.file?
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ module Sftp
|
||||||
def self.open(filepath:, &block)
|
def self.open(filepath:, &block)
|
||||||
sftp_url = ENV['SFTP_URL']
|
sftp_url = ENV['SFTP_URL']
|
||||||
uri = URI.parse(sftp_url)
|
uri = URI.parse(sftp_url)
|
||||||
Net::SFTP.start(uri.host, uri.user, password: uri.password) do |sftp|
|
Net::SFTP.start(uri.host, uri.user, password: uri.password, keepalive: true, keepalive_interval: 5) do |sftp|
|
||||||
sftp.file.open(filepath, 'r', &block)
|
sftp.file.open(filepath, 'r', &block)
|
||||||
end
|
end
|
||||||
rescue Net::SFTP::StatusException => e
|
rescue Net::SFTP::StatusException => e
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue