Created
June 25, 2020 01:27
-
-
Save jambun/77eb7e7e4efb7ba1ab7fbf8f26133c5c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RealtimeIndexing.class_eval do | |
def self.disable(&block) | |
Thread.current[:realtime_indexing_disabled] = true | |
block.call | |
# Thread.current[:realtime_indexing_disabled] = false | |
end | |
def self.record_update(target, uri) | |
unless Thread.current[:realtime_indexing_disabled] | |
longpolling.record_update(:record => target, :uri => uri) | |
end | |
end | |
def self.record_delete(uri) | |
unless Thread.current[:realtime_indexing_disabled] | |
longpolling.record_update(:record => :deleted, :uri => uri) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment