similar to: How to avoid simple race conditions with Session?

Displaying 20 results from an estimated 10000 matches similar to: "How to avoid simple race conditions with Session?"

2013 Feb 25
3
ActiveRecord associations: design question
Hi guys, In my Rails app, I have three models: A, B and C, with the following relationships: - B hasMany C - C belongsTo B I would like A to "has_one" instance of B+C. By that I mean A needs to be linked to a specific instance of B AND a specific instance of C. My first guess would be to create a fourth object, say B_plus_C that would: - belongs to B - belongs to C - belongs to A Is
2012 Apr 02
10
Pessimistic locking locks the entire table?
Hi guys, I must be missing something obvious with pessimistic locking. Here is what I do (Rails 2.3, mySQL): In my Foo model: def test Foo.transaction do lock = UpdateLockForFoo.find_by_foo_id(self.id, :lock => true) sleep 30 end end For each Foo model, I have an UpdateLockForFoo. This "lock" needs to be acquired before doing any changes to Foo. I believe it works,
2009 Oct 04
3
Problem using ActiveRecord find with :joins and :select
Hi guys, When I do: temp = User.find(:all, :joins => "INNER JOIN contents ON users.agent_id = contents.id", :select => "contents.id, users.id, users.u_date") temp.first.inspect It seems to work fine, but it only returns: #<User id: 6, u_date: "2009-10-03 19:32:23"> but not the contents.id information. I
2012 Aug 08
1
Memcache and Rails - Storing String as values.
Hello all, I have been using Memcache with my rails application to store certain key value pair.... I am using Dalli gem for the same... So Here''s what i do from console: require ''dalli'' dc = Dalli::Client.new(''remoteserver:11211'') dc.set(''example_link'', "http://www.google.com") => true value =
2006 Aug 01
8
Decoupled observers for controllers?
In the Rails Recipes book the recipe "Keeping track of who did what" explains how to do decoupled observing of models. In my application I''d like to do a similar thing but watching the controllers. For example, when somebody hits the login method of the Security controller, I''d like to make a note of it. In this case I could observe the User model and watch for
2008 Jan 23
11
Rails 2.0.2 + RJS
Hi I had ajax commenting on my app, which worked perfectly on Rails v1.2.6, but does not work the same in Rails 2.02. Basically the comment gets added, but the visual effects do not work (ie lines 2 + 3 of create.rjs) create.js page.insert_html :bottom, ''comments'', :partial => ''comment'' page.visual_effect :appear, "comment_#{@comment.id}"
2006 Jan 17
2
Getting data back from thread spawn
I have a script that needs to be run, that in some cases will take longer than the server timeout. So, I''m thinking just throw the script in its own thread, but I need to be able to get the data back from that thread and refresh the page with the data returned. Any suggestions how to do this? Thanks, PJ
2013 Feb 22
3
puppet could'nt find hiera even when hiera gem is installed
Hiera was properly working in my environment. But puppet was looking at old version even when I have the latest hiera gem installed. So I could''nt use json backend. But puppet is not looking at my latest hiera gem. Not sure when went wrong here. Scenario: I have installed hiera couple of months back. So the gem was installed under /opt/puppet/lib/gems/1.8/gems/hiera-0.3.0
2013 Feb 25
5
Rails CMS Suggestions
I am researching info on Rails CMS for work. Would like to get the communities opinion on what CMS they use and why they like that particular CMS. Thanks in advance. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to
2010 Sep 28
3
kgio library / RubyGem
Hello all, I''ve released kgio, a kinder, gentler I/O library for Ruby. Some of its features are useful for Unicorn, and all of it is useful for Rainbows! I intend to make kgio a requirement for both Unicorn and Rainbows!/Zbatery. I''m comfortable with the code, but extra testers and extra eyes to review it would be helpful (it''s nearly all C). There were several
2006 May 28
14
Lightbox and RJS
Hi, I am trying to include lightbox functionality in my app, but there is a slight complication. Apparently lightbox initializes all the links to lightbox events on page load. However, in my case, some new links to lightbox events will be rendered to the page through ajax events (obviously this means after the page loads). So I figure I need to find a way to call lightbox''s
2010 Nov 29
3
session active_record_store
Hi, There doesn''t seem to be any previous posts about this problem, I must be setting things up wrongly at very basics... Firstly, the problem... I can''t get session[] to persist with active_record_store. I enabled (config.action_controller.session_store = :active_record_store) in environment.rb and created the sessions table at my MySQL database. When I do a session[:blah] =
2010 Jan 10
3
Need advice: threads or Typhoeus?
Hi guys, I need my app to make a few hundreds requests to external web services as quickly as possible. The web services are fairly fast, but still: if I do the requests one after the other, it is too slow. My understanding is I have two options: a- Threads. b- Typhoeus Typhoeus seems great. Yet, the web services are all quite different (some are SOAP, some REST...) and therefore wrapped into
2010 Nov 20
6
unicorn 3.0.0 - disable rewindable input!
Changes: Rewindable "rack.input" may be disabled via the "rewindable_input false" directive in the configuration file. This will violate Rack::Lint for Rack 1.x applications, but can reduce I/O for applications that do not need a rewindable input. This release updates us to the Kgio 2.x series which should play more nicely with other libraries and applications. There are
2003 Sep 12
1
asterisk and defunct perl procs
Trying to figure out why I'm having all of my test (and demo) perl script in a defunct status. Each run creates a problem: ps output root 26253 1356 0 16:39 pts/1 00:00:00 asterisk -vvvc root 26270 26253 0 16:40 pts/1 00:00:00 [pj.pl <defunct>] root 26271 26253 0 16:40 pts/1 00:00:00 [pj.pl <defunct>] root 26273 26253 0 16:40 pts/1 00:00:00 [pj.pl
2013 Jun 23
1
Dsync only one mailbox
Hi, I am looking for a way to sync only selected files/mailbox'es using dsync. Am I using the dsync -m option incorectly? It looks like it's being ignored. And as for the main INBOX (/var/mail/username) what should be the parameter for -m? dovecot --version 2.1.7 dsync -u pj -D -v -m Alerts -o mail_location=mdbox:/home/pj/mdbox backup mbox:/home/pj/:INBOX=/var/mail/pj doveadm(root):
2017 Mar 20
3
Xen C6 kernel 4.9.13 and testing 4.9.15 only reboots.
El Lunes 20/03/2017, PJ Welsh escribi?: > Still just starts the kernel and wihtin 4 seconds reboots with 4.9.16-24. > Thanks > PJ Edit grub's entry and add "noreboot" to your xen parameters, maybe when the kernel panicks xen detects it and automatically reboots it. > On Mon, Mar 20, 2017 at 2:23 PM, Johnny Hughes <johnny at centos.org> wrote: > > On
2017 Nov 16
0
Re: [PATCH 0/3] Alternate way to avoid race conditions when nbdkit exits.
On 11/14/2017 11:30 AM, Richard W.M. Jones wrote: > This fixes the race conditions for me, using the test described here: > > https://www.redhat.com/archives/libguestfs/2017-September/msg00226.html Running test-socket-activation in a loop, I've hit other races (some provoked a bit more easily with the code I'm working on), and will be posting some patches where I know the
2006 Apr 27
15
Which is faster, calling helpers or rendering a partial?
Using partials is a nice way to separate chunks of content into separate pages as opposed to building strings in helpers, but I''m wondering which is faster. It scares me when I see stuff like: Rendered users/_public (0.00051) Rendered users/_public (0.00009) Rendered users/_public (0.00008) Rendered users/_public (0.00008) Rendered users/_public (0.00008) ....50 more times Has anyone
2017 Nov 14
0
[PATCH 2/3] Avoid race conditions when nbdkit exits.
There are several race conditions where nbdkit exits (calling plugin_cleanup() which unloads the plugin), while the plugin is either in a callback or in plugin.close(). Avoid these by: (1) Taking a shared lock around all plugin callbacks. (2) Taking the same as an exclusive lock in plugin_cleanup. This delays plugin_cleanup until all callbacks have finished. (3) Removing a few unnecessary