Git Product home page Git Product logo

Comments (4)

jdguzman avatar jdguzman commented on July 17, 2024

@dan Looking at delayed_paperclip code it looks like there is some memoization going on so perhaps you should try this:

has_attached_file :photo, {
  styles: {
    thumb:  ['100x100#', :jpg],
    medium: ['300x300#', :jpg],
  }
}.merge(PAPERCLIP_STORAGE_OPTIONS)

has_attached_file :picture, {
  styles: {
    thumb:  ['100x100#', :jpg],
    medium: ['300x300#', :jpg],
  }
}.merge(PAPERCLIP_STORAGE_OPTIONS)

process_in_background :photo
process_in_background :picture

from delayed_paperclip.

ryansouza avatar ryansouza commented on July 17, 2024

This looks like a legit bug in the way delayed_paperclip stores its data

process_in_background uses paperclip_definitions to store options for the delayed processing. paperclip_definitions caches the object it gets back from calling either attachment_definitions or Paperclip::Tasks::Attachments.definitions_for(self). Looking at paperclip master, definitions_for no longer exists, but attachment_definitions still does which hits Paperclip::AttachmentRegistry.definitions_for(self) which always returns a new hash with the current state of defined attachments. Due to the caching, this object won't be updated when new attachments are defined, so the second call cannot find any attachments defined after the first.

Looks like @jdguzman posted a workaround. As for delayed_paperclip, I think it should try and handle its own data, separate from paperclip's internal data.

from delayed_paperclip.

jdguzman avatar jdguzman commented on July 17, 2024

@ryansouza I agree that this looks like a bug. The quick and dirty solution would be to remove the memoization and take the, probably small, performance hit.

I may take a stab at a better solution later when I'm not under piles of work.

from delayed_paperclip.

ScotterC avatar ScotterC commented on July 17, 2024

Thanks for looking at this in depth. Pull requests would be very much appreciated.

from delayed_paperclip.

Related Issues (20)

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.