What have you found for these years?

2008-11-21

打/寫到興起就停不下來

真的是一點節制都沒有啊,每次一興起就是不管吃不管睡上廁所都不管...
搞不好明天世界末日也不管了。除了某些事吧,或許更重要。
總之這幾天的早睡都泡湯了...

不過還是很高興成功整合 storage 到 thumbo 裡吧
這樣 photo.rb 就變得超簡潔的 lol
expire_thumbnails 應該改個名字的。下一步是整合 eager/lazy...
這樣外面就不用再見到 exception. 還有 mogilefs-clinet 的 dep 可以拿掉?


def expire_thumbnails
create_eager_thumbnails
expire_lazy_thumbnails
end

# called in Upload#after_create
def create_eager_thumbnails
self.class.eager_labels.each{ |label|
create_thumbnail(thumbos[label])
}

# image changed, create new checksum
self.checksum = new_checksum

# save anything, including rotated info
save
end

def create_thumbnail thumbo
thumbo.create
thumbo.write
thumbo.release
end

def expire_lazy_thumbnails
self.class.lazy_labels.each{ |label|
begin
thumbos[label].delete

rescue MogileFS::Backend::UnknownKeyError
end
}
end

0 retries:

Post a Comment

Note: Only a member of this blog may post a comment.



All texts are licensed under CC Attribution 3.0