Commit f8e904fc by source_reader

bug fixes

parent e117d669
......@@ -39,9 +39,12 @@ module Joule
def __update_folder(db_folder, schema, parent_path)
attrs = schema.slice(*DbFolder.defined_attributes)
# check to see if this db_folder has changed since last update
attrs[:last_update] = schema[:updated_at].to_datetime
if db_folder.last_update >= attrs[:last_update]
return puts "ignoring #{db_folder.name}:#{db_folder.id}, #{db_folder.last_update}>#{schema[:updated_at]} "
# only do this if the joule node supports timestamps
if not schema[:updated_at].nil?
attrs[:last_update] = schema[:updated_at].to_datetime
if db_folder.last_update >= attrs[:last_update]
return puts "ignoring #{db_folder.name}:#{db_folder.id}, #{db_folder.last_update}>#{schema[:updated_at]} "
end
end
if db_folder.id.nil?
puts "creating #{schema[:name]}"
......@@ -111,6 +114,7 @@ module Joule
end
end
stream ||= DbStream.new(db_folder: db_folder, db: db_folder.db)
puts "Updating #{stream.name}"
__update_stream(stream, stream_schema, db_folder.path)
size_on_disk+=stream.size_on_disk unless stream.size_on_disk.nil?
unless stream.start_time.nil?
......@@ -165,6 +169,14 @@ module Joule
def __update_stream(db_stream, schema, parent_path)
attrs = schema.slice(*DbStream.defined_attributes)
# check to see if this stream has changed since last update
# only do this if the joule node supports timestamps
if not schema[:updated_at].nil?
attrs[:last_update] = schema[:updated_at].to_datetime
if db_stream.last_update >= attrs[:last_update]
return puts "ignoring Stream #{db_stream.name}:#{db_stream.id}, #{db_stream.last_update}>#{schema[:updated_at]} "
end
end
# add in extra attributes that require conversion
attrs[:path] = "#{parent_path}/#{schema[:name]}"
attrs[:data_type] = "#{schema[:datatype].downcase}_#{schema[:elements].count}"
......
......@@ -5,7 +5,7 @@
# a folder in the database, may contain one or more DbFiles as files
# and one or more DbFolders as subfolders
class DbFolder < ApplicationRecord
belongs_to :parent, class_name: 'DbFolder', optional: true
belongs_to :parent, class_name: 'DbFolder', optional: true, dependent: :destroy
belongs_to :db, optional: false
has_many :subfolders,
......
......@@ -77,6 +77,8 @@ Rails.application.configure do
end
end
config.web_console.permissions = '192.168.64.1'
# ------- Lumen Custom Settings ----------
#
......
# Be sure to restart your server when you modify this file.
#
# This file contains migration options to ease your Rails 6.1 upgrade.
#
# Once upgraded flip defaults one by one to migrate to the new default.
#
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
# Support for inversing belongs_to -> has_many Active Record associations.
Rails.application.config.active_record.has_many_inversing = true
# Track Active Storage variants in the database.
Rails.application.config.active_storage.track_variants = true
# Apply random variation to the delay when retrying failed jobs.
Rails.application.config.active_job.retry_jitter = 0.15
# Stop executing `after_enqueue`/`after_perform` callbacks if
# `before_enqueue`/`before_perform` respectively halts with `throw :abort`.
Rails.application.config.active_job.skip_after_callbacks_if_terminated = true
# Specify cookies SameSite protection level: either :none, :lax, or :strict.
#
# This change is not backwards compatible with earlier Rails versions.
# It's best enabled when your entire app is migrated and stable on 6.1.
Rails.application.config.action_dispatch.cookies_same_site_protection = :lax
# Generate CSRF tokens that are encoded in URL-safe Base64.
#
# This change is not backwards compatible with earlier Rails versions.
# It's best enabled when your entire app is migrated and stable on 6.1.
Rails.application.config.action_controller.urlsafe_csrf_tokens = true
# Specify whether `ActiveSupport::TimeZone.utc_to_local` returns a time with an
# UTC offset or a UTC time.
ActiveSupport.utc_to_local_returns_utc_offset_times = true
# Change the default HTTP status code to `308` when redirecting non-GET/HEAD
# requests to HTTPS in `ActionDispatch::SSL` middleware.
Rails.application.config.action_dispatch.ssl_default_redirect_status = 308
# Use new connection handling API. For most applications this won't have any
# effect. For applications using multiple databases, this new API provides
# support for granular connection swapping.
Rails.application.config.active_record.legacy_connection_handling = false
# Make `form_with` generate non-remote forms by default.
Rails.application.config.action_view.form_with_generates_remote_forms = false
# Set the default queue name for the analysis job to the queue adapter default.
Rails.application.config.active_storage.queues.analysis = nil
# Set the default queue name for the purge job to the queue adapter default.
Rails.application.config.active_storage.queues.purge = nil
# Set the default queue name for the incineration job to the queue adapter default.
Rails.application.config.action_mailbox.queues.incineration = nil
# Set the default queue name for the routing job to the queue adapter default.
Rails.application.config.action_mailbox.queues.routing = nil
# Set the default queue name for the mail deliver job to the queue adapter default.
Rails.application.config.action_mailer.deliver_later_queue_name = nil
# Generate a `Link` header that gives a hint to modern browsers about
# preloading assets when using `javascript_include_tag` and `stylesheet_link_tag`.
Rails.application.config.action_view.preload_links_header = true
......@@ -2,7 +2,7 @@
http_interactions:
- request:
method: get
uri: https://localhost:3030/streams.json
uri: https://localhost:3030/folders.json
body:
encoding: US-ASCII
string: ''
......
......@@ -67,7 +67,7 @@ http_interactions:
recorded_at: Mon, 08 Mar 2021 21:26:42 GMT
- request:
method: get
uri: https://localhost:3030/streams.json
uri: https://localhost:3030/folders.json
body:
encoding: US-ASCII
string: ''
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment