[noosfero/noosfero][master] 2 commits: delayed_job: port exception notifications to rails 3

Bráulio Bhavamitra braulio at eita.org.br
Tue Jun 2 21:04:39 BRT 2015


gonna check and fix it now, thanks

On Tue, Jun 2, 2015 at 9:00 PM, Leandro Nunes <leandronunes at gmail.com>
wrote:

> Braulio we can't make rake db:migrate or db:schema:load anymore because of
> this.
>
> Please it's really annoying take the master branch broke everytime.
>
> -------------------------
>
> user at serpro-1552757:~/projetos/noosfero$ rake db:migrate
> rake aborted!
> LoadError: cannot infer basepath
> /home/user/projetos/noosfero/vendor/plugins/monkey_patches/init.rb:1:in
> `require_relative'
> /home/user/projetos/noosfero/vendor/plugins/monkey_patches/init.rb:1:in
> `block in <class:Plugin>'
> -------------------------
>
> Please.
>
> Fix the unit tests falling related to enterprises too.
>
> w
>
>
> On Tue, Jun 2, 2015 at 3:37 PM, Bráulio Bhavamitra <gitlab at gitlab.com>
> wrote:
>
>>  Bráulio Bhavamitra pushed to branch master at Noosfero / noosfero
>> <https://gitlab.com/noosfero/noosfero> Commits:
>>
>>    - *c9a234ca
>>    <https://gitlab.com/noosfero/noosfero/commit/c9a234cad88608cadc7388aab7eb4f553bd67a2d>*
>>    by Braulio Bhavamitra *at 2015-05-20T21:13:02Z*
>>
>>    delayed_job: port exception notifications to rails 3
>>
>>     - *c51caedd
>>    <https://gitlab.com/noosfero/noosfero/commit/c51caedd718da2f1edafee0e075ca1cbeb776b2b>*
>>    by Bráulio Bhavamitra *at 2015-06-02T18:37:09Z*
>>
>>    Merge branch 'delayed-job-exception-notification' into 'master'
>>
>>    delayed_job: port exception notifications to rails 3
>>
>>    See merge request !580
>>
>>
>> 4 changed files:
>>
>>    -  config/initializers/delayed_job_config.rb
>>    <#14db6bbbd3832887_14db6b7ffa3d0899_14db59078f28c022_diff-0>
>>    -  vendor/plugins/delayed_job/lib/delayed/backend/base.rb
>>    <#14db6bbbd3832887_14db6b7ffa3d0899_14db59078f28c022_diff-1>
>>    -  vendor/plugins/monkey_patches/init.rb
>>    <#14db6bbbd3832887_14db6b7ffa3d0899_14db59078f28c022_diff-2>
>>    -  − vendor/plugins/monkey_patches/rescue_delayed_job_crashes/init.rb
>>    <#14db6bbbd3832887_14db6b7ffa3d0899_14db59078f28c022_diff-3>
>>
>> Changes:
>>  * config/initializers/delayed_job_config.rb *
>> <https://gitlab.com/noosfero/noosfero/compare/0bf5c21e5e02a4538df5033513072676d6c953c6...c51caedd718da2f1edafee0e075ca1cbeb776b2b#diff-0>
>> ------------------------------
>>
>> --- a/config/initializers/delayed_job_config.rb+++ b/config/initializers/delayed_job_config.rb@@ -23,3 +23,13 @@ end #  end
>>  #  alias_method_chain :handle_failed_job, :loggin
>>  #end+
>> +# Chain delayed job's handle_failed_job method to do exception notification
>> +Delayed::Worker.class_eval do
>> +  def handle_failed_job_with_notification job, error
>> +    handle_failed_job_without_notification job, error
>> +    ExceptionNotifier.notify_exception error, exception_recipients: NOOSFERO_CONF['exception_recipients'],
>> +      data: {job: job, handler: job.handler} rescue nil
>> +  end
>> +  alias_method_chain :handle_failed_job, :notification
>> +end
>>
>>
>>   * vendor/plugins/delayed_job/lib/delayed/backend/base.rb *
>> <https://gitlab.com/noosfero/noosfero/compare/0bf5c21e5e02a4538df5033513072676d6c953c6...c51caedd718da2f1edafee0e075ca1cbeb776b2b#diff-1>
>> ------------------------------
>>
>> --- a/vendor/plugins/delayed_job/lib/delayed/backend/base.rb+++ b/vendor/plugins/delayed_job/lib/delayed/backend/base.rb@@ -73,9 +73,8 @@ module Delayed       ParseObjectFromYaml = /\!ruby\/\w+\:([^\s]+)/
>>
>>        def name-        @name ||= payload_object.respond_to?(:display_name) ?
>> -                    payload_object.display_name :
>> -                    payload_object.class.name+        obj = payload_object
>> +        @name ||= obj.respond_to?(:display_name) ? obj.display_name : obj.class.name       rescue DeserializationError
>>          ParseObjectFromYaml.match(handler)[1]
>>        end
>>
>>
>>   * vendor/plugins/monkey_patches/init.rb *
>> <https://gitlab.com/noosfero/noosfero/compare/0bf5c21e5e02a4538df5033513072676d6c953c6...c51caedd718da2f1edafee0e075ca1cbeb776b2b#diff-2>
>> ------------------------------
>>
>> --- a/vendor/plugins/monkey_patches/init.rb+++ b/vendor/plugins/monkey_patches/init.rb@@ -1,3 +1,3 @@-require File.join(File.dirname(__FILE__), 'attachment_fu_validates_attachment/init')
>> -require File.join(File.dirname(__FILE__), 'attachment_fu/init')
>> -require File.join(File.dirname(__FILE__), 'white_list_sanitizer_unescape_before_reescape/init')+require_relative 'attachment_fu_validates_attachment/init'
>> +require_relative 'attachment_fu/init'
>> +require_relative 'white_list_sanitizer_unescape_before_reescape/init'
>>
>>
>>   * vendor/plugins/monkey_patches/rescue_delayed_job_crashes/init.rb *
>> deleted
>> <https://gitlab.com/noosfero/noosfero/compare/0bf5c21e5e02a4538df5033513072676d6c953c6...c51caedd718da2f1edafee0e075ca1cbeb776b2b#diff-3>
>> ------------------------------
>>
>> --- a/vendor/plugins/monkey_patches/rescue_delayed_job_crashes/init.rb+++ /dev/null@@ -1,57 +0,0 @@-Delayed::Worker.module_eval do-  # based on https://groups.google.com/forum/#!topic/delayed_job/ZGMUFFppNgs
>> -  class Delayed::Worker::ExceptionNotification < ActionMailer::Base
>> -    def mail job, error
>> -      environment = Environment.default--      recipients NOOSFERO_CONF['exception_recipients']
>> -      from       environment.noreply_email
>> -      reply_to   environment.noreply_email
>> -      subject    "[#{environment.name}] DelayedJob ##{job.id}: #{error.message}"
>> -      body       render(:text => "-Job:
>> -#{job.inspect}
>> -
>> -Handler:
>> -#{job.handler}
>> -
>> -Backtrace:
>> -#{error.backtrace.join("\n")}-      ")
>> -    end
>> -  end--  def handle_failed_job_with_notification(job, error)
>> -    Delayed::Worker::ExceptionNotification.deliver_mail job, error if NOOSFERO_CONF['exception_recipients'].present?
>> -    handle_failed_job_without_notification job, error
>> -  end
>> -  alias_method_chain :handle_failed_job, :notification--  def handle_failed_job_with_rescue(job, error)
>> -    handle_failed_job_without_rescue(job, error)
>> -  rescue => e # don't crash here
>> -  end
>> -  alias_method_chain :handle_failed_job, :rescue--  protected--  # This code must be replicated because there is no other way to pass the job
>> -  # through and use alias_method_chain as we used on the previous method
>> -  def reserve_and_run_one_job
>> -    # We get up to 5 jobs from the db. In case we cannot get exclusive access to a job we try the next.
>> -    # this leads to a more even distribution of jobs across the worker processes
>> -    job = Delayed::Job.find_available(name, 5, self.class.max_run_time).detect do |job|
>> -      if job.lock_exclusively!(self.class.max_run_time, name)
>> -        say "acquired lock on #{job.name}"
>> -        true
>> -      else
>> -        say "failed to acquire exclusive lock for #{job.name}", Logger::WARN
>> -        false
>> -      end
>> -    end--    run(job) if job
>> -  rescue => e
>> -    handle_failed_job(job, e)
>> -  end-end
>>
>>
>>>> View it on GitLab
>> <https://gitlab.com/noosfero/noosfero/compare/0bf5c21e5e02a4538df5033513072676d6c953c6...c51caedd718da2f1edafee0e075ca1cbeb776b2b>
>>
>> _______________________________________________
>> Noosfero-dev mailing list
>> Noosfero-dev at listas.softwarelivre.org
>> http://listas.softwarelivre.org/cgi-bin/mailman/listinfo/noosfero-dev
>>
>>
>
>
> --
> Dois Axé!!!
>
> -----
> "Comece fazendo o que é necessário, depois o que é possível e de repente
> você estará fazendo o impossível."
>                                    São Francisco de Assis
> Leandro Nunes
>
> _______________________________________________
> Noosfero-dev mailing list
> Noosfero-dev at listas.softwarelivre.org
> http://listas.softwarelivre.org/cgi-bin/mailman/listinfo/noosfero-dev
>
>


-- 
"Lute pela sua ideologia. Seja um com sua ideologia. Viva pela sua
ideologia. Morra por sua ideologia" P.R. Sarkar

EITA - Educação, Informação e Tecnologias para Autogestão
http://cirandas.net/brauliobo
http://eita.org.br

"Paramapurusha é meu pai e Parama Prakriti é minha mãe. O universo é meu
lar e todos nós somos cidadãos deste cosmo. Este universo é a imaginação da
Mente Macrocósmica, e todas as entidades estão sendo criadas, preservadas e
destruídas nas fases de extroversão e introversão do fluxo imaginativo
cósmico. No âmbito pessoal, quando uma pessoa imagina algo em sua mente,
naquele momento, essa pessoa é a única proprietária daquilo que ela
imagina, e ninguém mais. Quando um ser humano criado mentalmente caminha
por um milharal também imaginado, a pessoa imaginada não é a propriedade
desse milharal, pois ele pertence ao indivíduo que o está imaginando. Este
universo foi criado na imaginação de Brahma, a Entidade Suprema, por isso
a propriedade deste universo é de Brahma, e não dos microcosmos que também
foram criados pela imaginação de Brahma. Nenhuma propriedade deste mundo,
mutável ou imutável, pertence a um indivíduo em particular; tudo é o
patrimônio comum de todos."
Restante do texto em
http://cirandas.net/brauliobo/blog/a-problematica-de-hoje-em-dia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20150602/f6925bdf/attachment-0001.html>


More information about the Noosfero-dev mailing list