I think the name pulpo was looking for is rope caulk.
We also had an infestation of fruit flies and they are smarter and faster than the average fly

. Anyway I ended up using bottles with bait inside. Could not use sprays. Just sneak up and slip the cap on and throw it away. Ours started because my father living in an adjacent room let them get out of control. Once we removed their food supply and trapped the rest we were ok. But if they are not attracted to fruit as bait, they may be other critters as Gunguy suggests. MY the pleasures of owing a home. Some day I will tell my RAT story

.
Bud