GithubHelp home page GithubHelp logo

Comments (15)

JoshMcKin avatar JoshMcKin commented on May 30, 2024

Looks like its used in 3 places on master. Which was killing your performance?

https://github.com/amazonwebservices/aws-sdk-for-ruby/blob/master/lib/aws/sqs/queue.rb#L266

https://github.com/amazonwebservices/aws-sdk-for-ruby/blob/master/lib/aws/core/http/handler.rb#L69

https://github.com/amazonwebservices/aws-sdk-for-ruby/blob/master/lib/aws/core/client.rb#L241

from em_aws.

JoshMcKin avatar JoshMcKin commented on May 30, 2024

Also, why not use EM::Synchrony.sleep?

https://github.com/igrigorik/em-synchrony/blob/master/lib/em-synchrony.rb#L70

from em_aws.

JoshMcKin avatar JoshMcKin commented on May 30, 2024

Need some opinions on this patch...its pretty cooky but it will end the mutex and sleep issues:

require 'em-synchrony'
require 'em-synchrony/thread'
module AWS

  # Use EM::Synchrony sleep
  DupKernel = Kernel

  class PatchKernel
    class << self
      def sleep(count)
        EM::Synchrony.sleep(count)
      end
      def method_missing(method,*args,&block)
        DupKernel.send(method, *args, &block)
      end
    end
  end

  Kernel = PatchKernel

  # Use a fiber safe mutex
  Mutex = EM::Synchrony::Thread::Mutex 
end

from em_aws.

JoshMcKin avatar JoshMcKin commented on May 30, 2024

Try 0.1.5, it should resolve this issue.

from em_aws.

johnkchow avatar johnkchow commented on May 30, 2024

Have you guys seen any warnings when you re-set the constants? i.e.

Kernel = PatchKernel

A suggestion is to use Object.remove_const(:Kernel) right before so that there'd be no Ruby warning. Not that it's functionally any different of course :)

from em_aws.

JoshMcKin avatar JoshMcKin commented on May 30, 2024

Yeah....this was not one of my better moments, but what patch really is ;) Let me see what I can do to pretty that up.

from em_aws.

JoshMcKin avatar JoshMcKin commented on May 30, 2024

Strangely though, I do not get the overriding constant warning in MRI 1.9.2.

from em_aws.

JoshMcKin avatar JoshMcKin commented on May 30, 2024

@jkchow can you give master a try?

Thanks

from em_aws.

johnkchow avatar johnkchow commented on May 30, 2024

Looks good on my end. By the way, great job w/ the gem overall!

from em_aws.

johnkchow avatar johnkchow commented on May 30, 2024

By the way, I don't get the overriding constant error either when I try requiring the older version in IRB. shrugs oh wells

from em_aws.

johnkchow avatar johnkchow commented on May 30, 2024

After some thought, this patch might be too heavy. For one, there could be that rare edge case where users may actually want to Kernel.sleep or normal mutex (say they're using a script that first calls AWS via EM, then call EM.stop, then later on call Kernel.sleep.

I'd recommend in the #sleep and Mutex we do a check if EM is running and then delegate appropriately. What do you think?

EDIT : I saw the last commit just now, disregard this comment -.-

from em_aws.

JoshMcKin avatar JoshMcKin commented on May 30, 2024

@jkchow thanks, and if the last commit works for you I'll release a new version

from em_aws.

johnkchow avatar johnkchow commented on May 30, 2024

Ran a simple integration test on my project, looks good. Release that ish!

from em_aws.

JoshMcKin avatar JoshMcKin commented on May 30, 2024

Its out there.

from em_aws.

JoshMcKin avatar JoshMcKin commented on May 30, 2024

Should be resolved with latest releases.

from em_aws.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.