#48 new
ronin-14694 (at lighthouseapp)

Infinite loop/very long running task

Reported by ronin-14694 (at lighthouseapp) | May 3rd, 2008 @ 06:18 PM

I started out with this - using a clean db:


require 'rubygems'
require 'strokedb'

FileUtils.rm_rf 'test.strokedb' # cleanup the database
StrokeDB::Config.build :default => true, :base_path => 'test.strokedb'
include StrokeDB

Node = Meta.new do
  validates_presence_of :label
  
  # on_initialization do |node|
  #   node.nodes = [] unless node[:nodes]
  # end
  
end

root = Node.named('root', :label => 'root')

# root = Node.named('root')

p Node.find

then I comment-out the db-rebuild steps:


require 'rubygems'
require 'strokedb'

# FileUtils.rm_rf 'test.strokedb' # cleanup the database
StrokeDB::Config.build :default => true, :base_path => 'test.strokedb'
include StrokeDB

Node = Meta.new do
  validates_presence_of :label
  
  # on_initialization do |node|
  #   node.nodes = [] unless node[:nodes]
  # end
  
end

# root = Node.named('root', :label => 'root')

root = Node.named('root')

p Node.find

Everything is still fine. Then I uncomment the on_initialization code block:


require 'rubygems'
require 'strokedb'

# FileUtils.rm_rf 'test.strokedb' # cleanup the database
StrokeDB::Config.build :default => true, :base_path => 'test.strokedb'
include StrokeDB

Node = Meta.new do
  validates_presence_of :label
  
  on_initialization do |node|
    node.nodes = [] unless node[:nodes]
  end
  
end

# root = Node.named('root', :label => 'root')

root = Node.named('root')

p Node.find

This runs very long, probably in an infinite loop (didn't wait for it to finish after 30 secs).

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

StrokeDB is an embeddable distributed document database written in Ruby

Shared Ticket Bins

People watching this ticket