lib/slack/smart-bot/utils/get_teams.rb in slack-smart-bot-1.15.1 vs lib/slack/smart-bot/utils/get_teams.rb in slack-smart-bot-1.15.25
- old
+ new
@@ -22,7 +22,15 @@
teams_team[:name] = team_name unless teams_team.key?(:name) #to be backward compatible
@teams[team_name.to_sym] = teams_team
@datetime_teams_file[file] = File.mtime(file)
end
end
+ #remove from @teams and @datetime_teams_file the keys that are not in the files
+ #this is to avoid having old data in memory
+ @teams.keys.each do |key|
+ unless files.include?(File.join(config.path, "teams", "t_#{key}.yaml"))
+ @teams.delete(key)
+ @datetime_teams_file.delete(File.join(config.path, "teams", "t_#{key}.yaml"))
+ end
+ end
end
-end
\ No newline at end of file
+end