Re: lots of ReadConflictErrors

Jim Fulton <[email protected]>
Newsgroups gmane.comp.web.zope.zodb
Message-ID <CAPDm-FgY7V-3XwP7pouhAmvr-Uc2QeX9aV6b9VfRd2yoOKyK1A@mail.gmail.com>
On Fri, Oct 7, 2016 at 5:56 PM, Boylan, Ross <[email protected]> wrote:
> Yes; that's what I meant by the "thread you mention".  It seems to me it would lead to this kind of pattern (using your proposed decorator name):
>
> @transaction.manager.run
> def step1():
>     # some code for your first transaction
>
> @transaction.manager.run
> def step2():
>     # and for the second
>
> #etc
>
> def mainFn():
>     # so some stuff
>     step1()
>     # more computations here
>     step2()
>     # etc
>

Nope:

  def mainFn():

      @transaction.manager.run
      def step1():
            # some code for your first transaction

      @transaction.manager.run
      def step2():
          # and for the second

Or even:


  def mainFn():

      @transaction.manager.run
      def _():
            # some code for your first transaction

      @transaction.manager.run
      def _():
          # and for the second

The decorator *run*s the decorated function.

Jim

-- 
Jim Fulton
http://jimfulton.info

-- 
You received this message because you are subscribed to the Google Groups "zodb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.